Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,14 +57,14 @@ def store_message(chatinput: str, chatresponse: str):
|
|
| 57 |
file.write(f"{datetime.now()},{chatinput},{chatresponse}\n")
|
| 58 |
print(f"Wrote to datafile: {datetime.now()},{chatinput},{chatresponse}\n")
|
| 59 |
|
| 60 |
-
# Push back to hub every
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
|
| 69 |
store_message.count_calls = 1 #initiases the count at one. We want to count how many messages stored before pushing back to repo.
|
| 70 |
|
|
|
|
| 57 |
file.write(f"{datetime.now()},{chatinput},{chatresponse}\n")
|
| 58 |
print(f"Wrote to datafile: {datetime.now()},{chatinput},{chatresponse}\n")
|
| 59 |
|
| 60 |
+
# Push back to hub every N-th time the function is called
|
| 61 |
+
if store_message.count_calls % 1 == 0:
|
| 62 |
+
print("Pushing back to Hugging Face model hub")
|
| 63 |
+
# Call the push_to_hub() function to push the changes to the hub
|
| 64 |
+
push_to_hub(commit_message="Added new chat data") # Include commit_message parameter
|
| 65 |
+
store_message.count_calls += 1
|
| 66 |
+
|
| 67 |
+
return generate_text()
|
| 68 |
|
| 69 |
store_message.count_calls = 1 #initiases the count at one. We want to count how many messages stored before pushing back to repo.
|
| 70 |
|