Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,10 +52,17 @@ def generate_text() -> str:
|
|
| 52 |
|
| 53 |
def store_message(chatinput: str, chatresponse: str):
|
| 54 |
if chatinput and chatresponse:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
with open(DATA_FILE, "a") as file:
|
| 56 |
-
file.write(
|
| 57 |
-
print(f"Wrote to datafile: {
|
| 58 |
-
|
| 59 |
#need to find a way to push back to dataset repo
|
| 60 |
HF_WRITE_TOKEN = os.environ.get("WRITE_TOKEN")
|
| 61 |
api.upload_file(
|
|
|
|
| 52 |
|
| 53 |
def store_message(chatinput: str, chatresponse: str):
|
| 54 |
if chatinput and chatresponse:
|
| 55 |
+
|
| 56 |
+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 57 |
+
user_input = f"User: {chatinput}"
|
| 58 |
+
chatbot_response = f"Chatbot: {chatresponse}"
|
| 59 |
+
separator = "-" * 30
|
| 60 |
+
message = f"{timestamp}\n{user_input}\n{chatbot_response}\n{separator}\n"
|
| 61 |
+
|
| 62 |
with open(DATA_FILE, "a") as file:
|
| 63 |
+
file.write(message)
|
| 64 |
+
print(f"Wrote to datafile: {message}")
|
| 65 |
+
|
| 66 |
#need to find a way to push back to dataset repo
|
| 67 |
HF_WRITE_TOKEN = os.environ.get("WRITE_TOKEN")
|
| 68 |
api.upload_file(
|