test_simple
This commit is contained in:
parent
600a4b90e7
commit
4093965106
|
@ -8,4 +8,4 @@ RUN pip install -r requirements.txt
|
|||
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT ["python", "main.py"]
|
||||
ENTRYPOINT ["python", "main_simple.py"]
|
||||
|
|
14
main.py
14
main.py
|
@ -28,21 +28,23 @@ cors = CORS(app, resources={r"/api/predict": {"origins": url},
|
|||
r"/api/feedback": {"origins": url},
|
||||
r"/health": {"origins": "*"}
|
||||
})
|
||||
|
||||
"""
|
||||
conn = psycopg2.connect(
|
||||
host="janet-pg",
|
||||
database=os.getenv("POSTGRES_DB"),
|
||||
user=os.getenv("POSTGRES_USER"),
|
||||
password=os.getenv("POSTGRES_PASSWORD"))
|
||||
|
||||
"""
|
||||
"""
|
||||
conn = psycopg2.connect(host="https://janet-app-db.d4science.org",
|
||||
database="janet",
|
||||
user="janet_user",
|
||||
password="2fb5e81fec5a2d906a04")
|
||||
"""
|
||||
"""
|
||||
cur = conn.cursor()
|
||||
|
||||
"""
|
||||
|
||||
def vre_fetch():
|
||||
while True:
|
||||
|
@ -109,7 +111,7 @@ def predict():
|
|||
def feedback():
|
||||
data = request.get_json().get("feedback")
|
||||
print(data)
|
||||
|
||||
"""
|
||||
cur.execute('INSERT INTO feedback_trial (query, history, janet_modified_query, is_modified_query_correct, user_modified_query, response, preferred_response, response_length_feedback, response_fluency_feedback, response_truth_feedback, response_useful_feedback, response_time_feedback, response_intent) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
|
||||
(data['query'], data['history'], data['modQuery'],
|
||||
data['queryModCorrect'], data['correctQuery'],
|
||||
|
@ -118,7 +120,7 @@ def feedback():
|
|||
data['speed'], data['intent'])
|
||||
)
|
||||
conn.commit()
|
||||
|
||||
"""
|
||||
reply = jsonify({"status": "done"})
|
||||
return reply
|
||||
|
||||
|
@ -165,7 +167,7 @@ if __name__ == "__main__":
|
|||
|
||||
rg = ResponseGenerator(index,db, rec, generators, retriever)
|
||||
|
||||
|
||||
"""
|
||||
cur.execute('CREATE TABLE IF NOT EXISTS feedback_trial (id serial PRIMARY KEY,'
|
||||
'query text NOT NULL,'
|
||||
'history text NOT NULL,'
|
||||
|
@ -182,5 +184,5 @@ if __name__ == "__main__":
|
|||
'response_intent text NOT NULL);'
|
||||
)
|
||||
conn.commit()
|
||||
|
||||
"""
|
||||
app.run(host='0.0.0.0', port=4000)
|
||||
|
|
|
@ -4,10 +4,10 @@ import os
|
|||
|
||||
app = Flask(__name__)
|
||||
url = os.getenv("FRONTEND_URL_WITH_PORT")
|
||||
cors = CORS(app, resources={r"/predict": {"origins": url}, r"/feedback": {"origins": url}})
|
||||
cors = CORS(app, resources={r"/api/predict": {"origins": url}, r"/api/feedback": {"origins": url}, r"/health": {"origins": '*'}})
|
||||
|
||||
@app.route("/health", methods=['GET'])
|
||||
def check_health():
|
||||
def health():
|
||||
return "Success", 200
|
||||
|
||||
@app.route("/api/predict", methods=['POST'])
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
faiss-gpu==1.7.2
|
||||
pandas==1.3.5
|
||||
Flask==1.1.4
|
||||
flask-cors==3.0.10
|
||||
protobuf==3.20.0
|
||||
matplotlib==3.5.3
|
||||
nltk==3.7
|
||||
numpy==1.22.4
|
||||
pandas==1.3.5
|
||||
PyPDF2==3.0.1
|
||||
regex==2022.6.2
|
||||
requests==2.25.1
|
||||
scikit-learn==1.0.2
|
||||
scipy==1.7.3
|
||||
sentencepiece==0.1.97
|
||||
sklearn-pandas==1.8.0
|
||||
spacy==3.4.4
|
||||
spacy-alignments==0.9.0
|
||||
spacy-legacy==3.0.12
|
||||
spacy-loggers==1.0.4
|
||||
spacy-transformers==1.1.9
|
||||
spacy-experimental==0.6.2
|
||||
torch @ https://download.pytorch.org/whl/cu116/torch-1.13.1%2Bcu116-cp38-cp38-linux_x86_64.whl
|
||||
torchaudio @ https://download.pytorch.org/whl/cu116/torchaudio-0.13.1%2Bcu116-cp38-cp38-linux_x86_64.whl
|
||||
torchsummary==1.5.1
|
||||
torchtext==0.14.1
|
||||
sentence-transformers
|
||||
torchvision @ https://download.pytorch.org/whl/cu116/torchvision-0.14.1%2Bcu116-cp38-cp38-linux_x86_64.whl
|
||||
tqdm==4.64.1
|
||||
transformers
|
||||
markupsafe==2.0.1
|
||||
psycopg2==2.9.5
|
||||
en-coreference-web-trf @ https://github.com/explosion/spacy-experimental/releases/download/v0.6.1/en_coreference_web_trf-3.4.0a2-py3-none-any.whl
|
||||
Werkzeug==1.0.1
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue