Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,7 +33,7 @@ repo = Repository(
|
|
| 33 |
print(f"Repo local_dir: {repo.local_dir}")
|
| 34 |
print(f"Repo files: {os.listdir(repo.local_dir)}")
|
| 35 |
|
| 36 |
-
store_message.count_calls = 1 #initiases the count at one. We want to count how many messages stored.
|
| 37 |
|
| 38 |
def generate_text() -> str:
|
| 39 |
with open(DATA_FILE) as file:
|
|
@@ -53,7 +53,7 @@ def store_message(chatinput: str, chatresponse: str):
|
|
| 53 |
print(f"Wrote to datafile: {datetime.now()},{chatinput},{chatresponse}\n")
|
| 54 |
|
| 55 |
# Push back to hub every 10th time the function is called
|
| 56 |
-
|
| 57 |
print("Pushing back to Hugging Face model hub")
|
| 58 |
# Call the push_to_hub() function to push the changes to the hub
|
| 59 |
push_to_hub(commit_message="Added new chat data")
|
|
@@ -61,8 +61,6 @@ def store_message(chatinput: str, chatresponse: str):
|
|
| 61 |
|
| 62 |
return generate_text()
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
|
| 67 |
#gets the index file which is the context data
|
| 68 |
def get_index(index_file_path):
|
|
|
|
| 33 |
print(f"Repo local_dir: {repo.local_dir}")
|
| 34 |
print(f"Repo files: {os.listdir(repo.local_dir)}")
|
| 35 |
|
| 36 |
+
store_message.count_calls = 1 #initiases the count at one. We want to count how many messages stored before pushing back to repo.
|
| 37 |
|
| 38 |
def generate_text() -> str:
|
| 39 |
with open(DATA_FILE) as file:
|
|
|
|
| 53 |
print(f"Wrote to datafile: {datetime.now()},{chatinput},{chatresponse}\n")
|
| 54 |
|
| 55 |
# Push back to hub every 10th time the function is called
|
| 56 |
+
if store_message.count_calls % 10 == 0:
|
| 57 |
print("Pushing back to Hugging Face model hub")
|
| 58 |
# Call the push_to_hub() function to push the changes to the hub
|
| 59 |
push_to_hub(commit_message="Added new chat data")
|
|
|
|
| 61 |
|
| 62 |
return generate_text()
|
| 63 |
|
|
|
|
|
|
|
| 64 |
|
| 65 |
#gets the index file which is the context data
|
| 66 |
def get_index(index_file_path):
|