This commit is contained in:
ahmed531998 2023-04-17 04:14:44 +02:00
parent 89af765b1a
commit 7ccc919e03
1 changed files with 7 additions and 2 deletions

View File

@ -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)