Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,14 +12,11 @@ with strategy.scope():
|
|
| 12 |
model = TFBlenderbotForConditionalGeneration.from_pretrained(model_name)
|
| 13 |
|
| 14 |
def save_question(question,answer,path = "question_answer.json"):
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
json.dump(data, file, indent=4)
|
| 21 |
-
except Exception as e:
|
| 22 |
-
print(f"Error with {e}")
|
| 23 |
|
| 24 |
print("Interface getting done....")
|
| 25 |
# Define the chatbot function
|
|
|
|
| 12 |
model = TFBlenderbotForConditionalGeneration.from_pretrained(model_name)
|
| 13 |
|
| 14 |
def save_question(question,answer,path = "question_answer.json"):
|
| 15 |
+
with open(path, "r") as file:
|
| 16 |
+
data = json.load(file)
|
| 17 |
+
data.append({"Question:":question,"Answer:":answer})
|
| 18 |
+
with open(path, "w") as file:
|
| 19 |
+
json.dump(data, file, indent=4)
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
print("Interface getting done....")
|
| 22 |
# Define the chatbot function
|