Spaces:
Build error
Build error
zhenyundeng
commited on
Commit
•
99c6d37
1
Parent(s):
016ab20
update files
Browse files
app.py
CHANGED
@@ -42,6 +42,7 @@ try:
|
|
42 |
except Exception as e:
|
43 |
pass
|
44 |
|
|
|
45 |
account_url = os.environ["AZURE_ACCOUNT_URL"]
|
46 |
credential = {
|
47 |
"account_key": os.environ['AZURE_ACCOUNT_KEY'],
|
@@ -59,6 +60,7 @@ import wikipediaapi
|
|
59 |
wiki_wiki = wikipediaapi.Wikipedia('AVeriTeC (zd302@cam.ac.uk)', 'en')
|
60 |
|
61 |
import nltk
|
|
|
62 |
nltk.download('punkt')
|
63 |
from nltk import pos_tag, word_tokenize, sent_tokenize
|
64 |
|
@@ -71,7 +73,7 @@ nlp = spacy.load("en_core_web_sm")
|
|
71 |
# all_samples_dict = json.load(open('averitec/data/all_samples.json', 'r'))
|
72 |
train_examples = json.load(open('averitec/data/train.json', 'r'))
|
73 |
|
74 |
-
print(train_examples[0]['claim'])
|
75 |
# ---------------------------------------------------------------------------
|
76 |
# ---------- Load pretrained models ----------
|
77 |
# ---------- load Evidence retrieval model ----------
|
@@ -1391,8 +1393,8 @@ def chat(claim, history, sources):
|
|
1391 |
# Log answer on Azure Blob Storage
|
1392 |
# IF AZURE_ISSAVE=TRUE, save the logs into the Azure share client.
|
1393 |
if os.environ["AZURE_ISSAVE"] == "TRUE":
|
1394 |
-
timestamp = str(datetime.now().timestamp())
|
1395 |
-
|
1396 |
file = timestamp + ".json"
|
1397 |
logs = {
|
1398 |
"user_id": str(user_id),
|
|
|
42 |
except Exception as e:
|
43 |
pass
|
44 |
|
45 |
+
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
46 |
account_url = os.environ["AZURE_ACCOUNT_URL"]
|
47 |
credential = {
|
48 |
"account_key": os.environ['AZURE_ACCOUNT_KEY'],
|
|
|
60 |
wiki_wiki = wikipediaapi.Wikipedia('AVeriTeC (zd302@cam.ac.uk)', 'en')
|
61 |
|
62 |
import nltk
|
63 |
+
nltk.download('averaged_perceptron_tagger')
|
64 |
nltk.download('punkt')
|
65 |
from nltk import pos_tag, word_tokenize, sent_tokenize
|
66 |
|
|
|
73 |
# all_samples_dict = json.load(open('averitec/data/all_samples.json', 'r'))
|
74 |
train_examples = json.load(open('averitec/data/train.json', 'r'))
|
75 |
|
76 |
+
# print(train_examples[0]['claim'])
|
77 |
# ---------------------------------------------------------------------------
|
78 |
# ---------- Load pretrained models ----------
|
79 |
# ---------- load Evidence retrieval model ----------
|
|
|
1393 |
# Log answer on Azure Blob Storage
|
1394 |
# IF AZURE_ISSAVE=TRUE, save the logs into the Azure share client.
|
1395 |
if os.environ["AZURE_ISSAVE"] == "TRUE":
|
1396 |
+
# timestamp = str(datetime.now().timestamp())
|
1397 |
+
timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
1398 |
file = timestamp + ".json"
|
1399 |
logs = {
|
1400 |
"user_id": str(user_id),
|
utils.py
CHANGED
@@ -9,6 +9,6 @@ def create_user_id():
|
|
9 |
"""Create user_id
|
10 |
str: String to id user
|
11 |
"""
|
12 |
-
current_date = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
13 |
user_id = str(uuid.uuid4())
|
14 |
-
return
|
|
|
9 |
"""Create user_id
|
10 |
str: String to id user
|
11 |
"""
|
12 |
+
# current_date = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
13 |
user_id = str(uuid.uuid4())
|
14 |
+
return user_id
|