Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,8 +40,8 @@ def generate_html() -> str:
|
|
| 40 |
html = "<div class='chatbot'>"
|
| 41 |
for row in rows:
|
| 42 |
html += "<div>"
|
| 43 |
-
html += f"<span>{row['
|
| 44 |
-
html += f"<span class='message'>{row['
|
| 45 |
html += f"<span class='time'>{row['time']}</span>"
|
| 46 |
html += "</div>"
|
| 47 |
html += "</div>"
|
|
@@ -50,10 +50,10 @@ def generate_html() -> str:
|
|
| 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 |
|
|
|
|
| 40 |
html = "<div class='chatbot'>"
|
| 41 |
for row in rows:
|
| 42 |
html += "<div>"
|
| 43 |
+
html += f"<span>{row['User']}</span>"
|
| 44 |
+
html += f"<span class='message'>{row['Chatbot']}</span>"
|
| 45 |
html += f"<span class='time'>{row['time']}</span>"
|
| 46 |
html += "</div>"
|
| 47 |
html += "</div>"
|
|
|
|
| 50 |
def store_message(chatinput: str, chatresponse: str):
|
| 51 |
if chatinput and chatresponse:
|
| 52 |
with open(DATA_FILE, "a") as csvfile:
|
| 53 |
+
writer = csv.DictWriter(csvfile, fieldnames=["User", "Chatbot", "time"])
|
| 54 |
+
writer.writerow(
|
| 55 |
+
{"User": chatinput, "Chatbot": chatresponse, "time": str(datetime.now())}
|
| 56 |
+
)
|
| 57 |
commit_url = repo.push_to_hub()
|
| 58 |
print(commit_url)
|
| 59 |
|