Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,14 +46,13 @@ def generate_html() -> str:
|
|
| 46 |
html += "</div>"
|
| 47 |
return html
|
| 48 |
|
| 49 |
-
|
| 50 |
def store_message(chatinput: str, chatresponse: str):
|
| 51 |
if chatinput and chatresponse:
|
| 52 |
with open(DATA_FILE, "a") as csvfile:
|
| 53 |
-
writer = csv.
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
)
|
| 57 |
commit_url = repo.push_to_hub()
|
| 58 |
print(commit_url)
|
| 59 |
|
|
|
|
| 46 |
html += "</div>"
|
| 47 |
return html
|
| 48 |
|
|
|
|
| 49 |
def store_message(chatinput: str, chatresponse: str):
|
| 50 |
if chatinput and chatresponse:
|
| 51 |
with open(DATA_FILE, "a") as csvfile:
|
| 52 |
+
writer = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
| 53 |
+
if csvfile.tell() == 0:
|
| 54 |
+
writer.writerow(['User input', 'Chatbot response', 'Date and Time'])
|
| 55 |
+
writer.writerow([chatinput, chatresponse, datetime.now().strftime('%Y-%m-%d %H:%M:%S')])
|
| 56 |
commit_url = repo.push_to_hub()
|
| 57 |
print(commit_url)
|
| 58 |
|