Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,6 +44,14 @@ def generate_text() -> str:
|
|
| 44 |
text += f"Time: {time}\nUser: {user}\nChatbot: {chatbot}\n\n"
|
| 45 |
return text if text else "No messages yet"
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
def store_message(chatinput: str, chatresponse: str):
|
| 48 |
if chatinput and chatresponse:
|
| 49 |
with open(DATA_FILE, "a") as file:
|
|
|
|
| 44 |
text += f"Time: {time}\nUser: {user}\nChatbot: {chatbot}\n\n"
|
| 45 |
return text if text else "No messages yet"
|
| 46 |
|
| 47 |
+
|
| 48 |
+
def push_to_hub(commit_message):
|
| 49 |
+
repo.git_pull() # Make sure to pull the latest changes
|
| 50 |
+
repo.git_add(os.path.join("data", DATA_FILENAME)) # Add the updated data file to the staged changes
|
| 51 |
+
repo.git_commit(commit_message) # Commit the changes
|
| 52 |
+
repo.push_to_hub(token=HF_TOKEN) # Push the changes to the remote repository
|
| 53 |
+
|
| 54 |
+
|
| 55 |
def store_message(chatinput: str, chatresponse: str):
|
| 56 |
if chatinput and chatresponse:
|
| 57 |
with open(DATA_FILE, "a") as file:
|