Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,17 +26,6 @@ repo = Repository(
|
|
| 26 |
clone_from=DATASET_REPO_URL,
|
| 27 |
use_auth_token=HF_TOKEN)
|
| 28 |
|
| 29 |
-
def generate_text() -> str:
|
| 30 |
-
with open(DATA_FILE) as file:
|
| 31 |
-
text = ""
|
| 32 |
-
for line in file:
|
| 33 |
-
row_parts = line.strip().split(",")
|
| 34 |
-
if len(row_parts) != 3:
|
| 35 |
-
continue
|
| 36 |
-
time, user, chatbot = row_parts
|
| 37 |
-
text += f"Time: {time}\nUser: {user}\nChatbot: {chatbot}\n\n"
|
| 38 |
-
return text if text else "No messages yet"
|
| 39 |
-
|
| 40 |
def store_message(chatinput: str, chatresponse: str):
|
| 41 |
if chatinput and chatresponse:
|
| 42 |
with open(DATA_FILE, "a") as file:
|
|
@@ -45,8 +34,6 @@ def store_message(chatinput: str, chatresponse: str):
|
|
| 45 |
file.write(f"{timestamp},{chatinput},{chatresponse}\n")
|
| 46 |
print(f"Stored message: {timestamp},{chatinput},{chatresponse}")
|
| 47 |
|
| 48 |
-
return generate_text()
|
| 49 |
-
|
| 50 |
|
| 51 |
#gets the index file which is the context data
|
| 52 |
def get_index(index_file_path):
|
|
|
|
| 26 |
clone_from=DATASET_REPO_URL,
|
| 27 |
use_auth_token=HF_TOKEN)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
def store_message(chatinput: str, chatresponse: str):
|
| 30 |
if chatinput and chatresponse:
|
| 31 |
with open(DATA_FILE, "a") as file:
|
|
|
|
| 34 |
file.write(f"{timestamp},{chatinput},{chatresponse}\n")
|
| 35 |
print(f"Stored message: {timestamp},{chatinput},{chatresponse}")
|
| 36 |
|
|
|
|
|
|
|
| 37 |
|
| 38 |
#gets the index file which is the context data
|
| 39 |
def get_index(index_file_path):
|