Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from transformers import AutoTokenizer, TFBlenderbotForConditionalGeneration
|
|
3 |
import tensorflow as tf
|
4 |
import json
|
5 |
import os
|
|
|
6 |
|
7 |
data = {"Interactions":[]}
|
8 |
with open("question_answer.json", "w") as file:
|
@@ -19,7 +20,7 @@ with strategy.scope():
|
|
19 |
def save_question(question,answer,path = "question_answer.json"):
|
20 |
with open(path, "r") as file:
|
21 |
data = json.load(file)
|
22 |
-
data["Interactions"].append({"Question:":question,"Answer:":answer})
|
23 |
print(data)
|
24 |
with open(path, "w") as file:
|
25 |
json.dump(data, file, indent=4)
|
|
|
3 |
import tensorflow as tf
|
4 |
import json
|
5 |
import os
|
6 |
+
from datetime import datetime
|
7 |
|
8 |
data = {"Interactions":[]}
|
9 |
with open("question_answer.json", "w") as file:
|
|
|
20 |
def save_question(question,answer,path = "question_answer.json"):
|
21 |
with open(path, "r") as file:
|
22 |
data = json.load(file)
|
23 |
+
data["Interactions"].append({"Question:":question,"Answer:":answer,"Time:":datetime.now().strftime("%Y-%m-%d %H:%M:%S")})
|
24 |
print(data)
|
25 |
with open(path, "w") as file:
|
26 |
json.dump(data, file, indent=4)
|