This commit is contained in:
ahmed531998 2023-04-04 21:41:45 +02:00
parent e1dfb0da74
commit c782a1db68
1 changed files with 4 additions and 3 deletions

View File

@ -27,7 +27,8 @@ url = os.getenv("FRONTEND_URL_WITH_PORT")
cors = CORS(app, resources={r"/predict": {"origins": url}, r"/feedback": {"origins": url}}) cors = CORS(app, resources={r"/predict": {"origins": url}, r"/feedback": {"origins": url}})
conn = psycopg2.connect( conn = psycopg2.connect(
host="https://janet-app-db.d4science.org", host="janet-pg",
port=5432,
database=os.getenv("POSTGRES_DB"), database=os.getenv("POSTGRES_DB"),
user=os.getenv("POSTGRES_USER"), user=os.getenv("POSTGRES_USER"),
password=os.getenv("POSTGRES_PASSWORD")) password=os.getenv("POSTGRES_PASSWORD"))
@ -103,7 +104,7 @@ def feedback():
data['fluency'], data['truthfulness'], data['usefulness'], data['fluency'], data['truthfulness'], data['usefulness'],
data['speed'], data['intent']) data['speed'], data['intent'])
) )
conn.commit()
reply = jsonify({"status": "done"}) reply = jsonify({"status": "done"})
return reply return reply
@ -166,5 +167,5 @@ if __name__ == "__main__":
'response_time_feedback text NOT NULL,' 'response_time_feedback text NOT NULL,'
'response_intent text NOT NULL);' 'response_intent text NOT NULL);'
) )
conn.commit()
app.run(host='127.0.0.1', port=4000) app.run(host='127.0.0.1', port=4000)