Optimised spacy first loading
This commit is contained in:
parent
d9cf5e56de
commit
dc23d6a80a
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
import flask
|
||||
from flask import Flask, request, jsonify, Response
|
||||
|
||||
import jarvis.ia.process
|
||||
from utils import config_utils, flask_utils, intents_utils, utils
|
||||
|
||||
app = Flask(__name__)
|
||||
@ -14,7 +15,7 @@ def process_request():
|
||||
flask.abort(Response('You must provide a \'sentence\' parameter (not empty aswell)!'))
|
||||
|
||||
sentence = data['sentence']
|
||||
tag_for_request = src.ia.process.get_tag_for_sentence(sentence)
|
||||
tag_for_request = jarvis.ia.process.get_tag_for_sentence(sentence)
|
||||
|
||||
print("SENTENCE : " + sentence + " /// TAG : " + tag_for_request)
|
||||
|
||||
|
@ -2,8 +2,13 @@ import spacy
|
||||
|
||||
from jarvis.utils import languages_utils
|
||||
|
||||
nlp = None
|
||||
|
||||
|
||||
def get_spacy_nlp():
|
||||
global nlp
|
||||
|
||||
if nlp is None:
|
||||
nlp = spacy.load(languages_utils.get_spacy_model())
|
||||
return nlp
|
||||
|
||||
|
Reference in New Issue
Block a user