Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -208,6 +208,10 @@ def get_response(query):
|
|
| 208 |
|
| 209 |
return response
|
| 210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
with gr.Blocks() as iface:
|
| 212 |
gr.Markdown(
|
| 213 |
"""
|
|
@@ -231,6 +235,7 @@ with gr.Blocks() as iface:
|
|
| 231 |
chat_history.append(
|
| 232 |
(f"**You:** {message}", f"**Anjibot:** {bot_message}")
|
| 233 |
)
|
|
|
|
| 234 |
time.sleep(2)
|
| 235 |
return "", chat_history
|
| 236 |
|
|
|
|
| 208 |
|
| 209 |
return response
|
| 210 |
|
| 211 |
+
def log_chats(history):
|
| 212 |
+
with open("chat_Logs.json", "a") as file:
|
| 213 |
+
json.dump(history, file)
|
| 214 |
+
|
| 215 |
with gr.Blocks() as iface:
|
| 216 |
gr.Markdown(
|
| 217 |
"""
|
|
|
|
| 235 |
chat_history.append(
|
| 236 |
(f"**You:** {message}", f"**Anjibot:** {bot_message}")
|
| 237 |
)
|
| 238 |
+
log_chats(chat_history)
|
| 239 |
time.sleep(2)
|
| 240 |
return "", chat_history
|
| 241 |
|