trial
This commit is contained in:
parent
17e8dbffe1
commit
90ccc111e8
|
@ -2,6 +2,8 @@ from flask import Flask, request, jsonify
|
||||||
from flask_cors import CORS, cross_origin
|
from flask_cors import CORS, cross_origin
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import psycopg2
|
||||||
|
import requests
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
url = os.getenv("FRONTEND_URL_WITH_PORT")
|
url = os.getenv("FRONTEND_URL_WITH_PORT")
|
||||||
|
@ -11,13 +13,15 @@ cors = CORS(app, resources={r"/api/predict": {"origins": url},
|
||||||
r"/health": {"origins": "*"}
|
r"/health": {"origins": "*"}
|
||||||
})
|
})
|
||||||
users = {}
|
users = {}
|
||||||
|
|
||||||
conn = psycopg2.connect(
|
conn = psycopg2.connect(
|
||||||
host="janet-pg",
|
host="janet-pg",
|
||||||
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"))
|
||||||
|
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
|
|
||||||
@app.route("/health", methods=['GET'])
|
@app.route("/health", methods=['GET'])
|
||||||
def health():
|
def health():
|
||||||
return "Success", 200
|
return "Success", 200
|
||||||
|
@ -66,6 +70,7 @@ def feedback():
|
||||||
return reply
|
return reply
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
cur.execute('CREATE TABLE IF NOT EXISTS feedback_experimental (id serial PRIMARY KEY,'
|
cur.execute('CREATE TABLE IF NOT EXISTS feedback_experimental (id serial PRIMARY KEY,'
|
||||||
'query text NOT NULL,'
|
'query text NOT NULL,'
|
||||||
'history text NOT NULL,'
|
'history text NOT NULL,'
|
||||||
|
@ -82,4 +87,5 @@ if __name__ == "__main__":
|
||||||
'response_intent text NOT NULL);'
|
'response_intent text NOT NULL);'
|
||||||
)
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
app.run(host='0.0.0.0')
|
app.run(host='0.0.0.0')
|
||||||
|
|
Loading…
Reference in New Issue