fix
This commit is contained in:
parent
89af765b1a
commit
7ccc919e03
9
main.py
9
main.py
|
@ -26,6 +26,7 @@ app = Flask(__name__)
|
|||
url = os.getenv("FRONTEND_URL_WITH_PORT")
|
||||
cors = CORS(app, resources={r"/api/predict": {"origins": url},
|
||||
r"/api/feedback": {"origins": url},
|
||||
r"/api/dm": {"origins": url},
|
||||
r"/health": {"origins": "*"}
|
||||
})
|
||||
|
||||
|
@ -37,6 +38,7 @@ conn = psycopg2.connect(
|
|||
|
||||
cur = conn.cursor()
|
||||
|
||||
dm = None
|
||||
|
||||
def vre_fetch():
|
||||
while True:
|
||||
|
@ -57,6 +59,11 @@ def user_interest_decay():
|
|||
def health():
|
||||
return "Success", 200
|
||||
|
||||
@app.route("/api/dm", methods=['GET'])
|
||||
def init_dm():
|
||||
dm = DM()
|
||||
return "Sucess", 200
|
||||
|
||||
@app.route("/api/predict", methods=['POST'])
|
||||
def predict():
|
||||
text = request.get_json().get("message")
|
||||
|
@ -155,8 +162,6 @@ if __name__ == "__main__":
|
|||
threading.Thread(target=user_interest_decay, name='decayinterest').start()
|
||||
|
||||
rec = Recommender(retriever)
|
||||
|
||||
dm = DM()
|
||||
|
||||
rg = ResponseGenerator(index,db, rec, generators, retriever)
|
||||
|
||||
|
|
Loading…
Reference in New Issue