syntax_fix

This commit is contained in:
ahmed531998 2023-04-04 15:53:07 +02:00
parent 35dacc59a7
commit 2e3aac3f47
1 changed files with 3 additions and 5 deletions

View File

@ -25,19 +25,18 @@ from sentence_transformers import SentenceTransformer
app = Flask(__name__) app = Flask(__name__)
url = os.getenv("FRONTEND_URL_WITH_PORT") 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="https://janet-app-db.d4science.org",
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"))
""" """
conn = psycopg2.connect(host="https://janet-app-db.d4science.org", conn = psycopg2.connect(host="https://janet-app-db.d4science.org",
database="janet", database="janet",
user="janet_user", user="janet_user",
password="2fb5e81fec5a2d906a04") password="2fb5e81fec5a2d906a04")
"""
cur = conn.cursor() cur = conn.cursor()
@ -83,8 +82,7 @@ def predict():
user.update_interests(user_interests) user.update_interests(user_interests)
dm.update(state) dm.update(state)
action = dm.next_action() action = dm.next_action()
self, action, utterance=None, username=None, state=None, consec_history=None response = rg.gen_response(action=action, utterance=state['modified_query'], state=dm.get_recent_state(), consec_history=dm.get_consec_history())
response = rg.gen_response(action, utterance=state['modified_query'], state=dm.get_recent_state(), consec_history=dm.get_consec_history())
message = {"answer": response, "query": text, "cand": "candidate", "history": dm.get_consec_history(), "modQuery": state['modified_query']} message = {"answer": response, "query": text, "cand": "candidate", "history": dm.get_consec_history(), "modQuery": state['modified_query']}
new_state = {'modified_query': response} new_state = {'modified_query': response}
dm.update(new_state) dm.update(new_state)