Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,6 @@ data = {"Interactions":[]}
|
|
| 9 |
with open("question_answer.json", "w") as file:
|
| 10 |
json.dump(data, file, indent=4)
|
| 11 |
|
| 12 |
-
print(f"at start {data}")
|
| 13 |
print("Loading the model......")
|
| 14 |
model_name = "WICKED4950/Irisonego5"
|
| 15 |
strategy = tf.distribute.MirroredStrategy()
|
|
@@ -22,7 +21,6 @@ def save_question(question,answer,path = "question_answer.json"):
|
|
| 22 |
with open(path, "r") as file:
|
| 23 |
data = json.load(file)
|
| 24 |
data["Interactions"].append({"Question:":question,"Answer:":answer,"Time:":datetime.now().strftime("%Y-%m-%d %H:%M:%S")})
|
| 25 |
-
print(f"saving and now {data}")
|
| 26 |
with open(path, "w") as file:
|
| 27 |
json.dump(data, file, indent=4)
|
| 28 |
|
|
@@ -30,8 +28,8 @@ print("Interface getting done....")
|
|
| 30 |
# Define the chatbot function
|
| 31 |
def predict(user_input):
|
| 32 |
if user_input == "Print_data_hmm":
|
| 33 |
-
|
| 34 |
-
|
| 35 |
return "Done"
|
| 36 |
else:
|
| 37 |
inputs = tokenizer(user_input, return_tensors="tf", padding=True, truncation=True)
|
|
|
|
| 9 |
with open("question_answer.json", "w") as file:
|
| 10 |
json.dump(data, file, indent=4)
|
| 11 |
|
|
|
|
| 12 |
print("Loading the model......")
|
| 13 |
model_name = "WICKED4950/Irisonego5"
|
| 14 |
strategy = tf.distribute.MirroredStrategy()
|
|
|
|
| 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 |
with open(path, "w") as file:
|
| 25 |
json.dump(data, file, indent=4)
|
| 26 |
|
|
|
|
| 28 |
# Define the chatbot function
|
| 29 |
def predict(user_input):
|
| 30 |
if user_input == "Print_data_hmm":
|
| 31 |
+
with open("question_answer.json", "r") as file:
|
| 32 |
+
print(json.load(file))
|
| 33 |
return "Done"
|
| 34 |
else:
|
| 35 |
inputs = tokenizer(user_input, return_tensors="tf", padding=True, truncation=True)
|