This commit is contained in:
ahmed531998 2023-04-18 23:09:33 +02:00
parent 968f94b4b8
commit b7737efe0c
1 changed files with 10 additions and 0 deletions

10
main.py
View File

@ -7,6 +7,7 @@ from flask_cors import CORS, cross_origin
import psycopg2
import spacy
import requests
import shutil
import spacy_transformers
import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
@ -202,6 +203,15 @@ if __name__ == "__main__":
threading.Thread(target=clear_inactive, name='clear').start()
rec = Recommender(retriever)
for filename in os.listdir("/app/"):
file_path = os.path.join(folder, filename)
try:
if os.path.isfile(file_path) or os.path.islink(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path)
except Exception as e:
print('Failed to delete %s. Reason: %s' % (file_path, e))
cur.execute('CREATE TABLE IF NOT EXISTS feedback_experimental (id serial PRIMARY KEY,'
'query text NOT NULL,'