Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -253,14 +253,21 @@ with gr.Blocks(
|
|
| 253 |
|
| 254 |
return filename
|
| 255 |
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
#launching chatbot
|
| 265 |
demo.launch()
|
| 266 |
|
|
|
|
| 253 |
|
| 254 |
return filename
|
| 255 |
|
| 256 |
+
with gr.Blocks() as demo:
|
| 257 |
+
chatbot = gr.Chatbot()
|
| 258 |
+
username_input = gr.Textbox(label="Username")
|
| 259 |
+
save_button = gr.Button("Save Chat History")
|
| 260 |
+
download_button = gr.File(label="Download Chat History", visible=False)
|
| 261 |
+
|
| 262 |
+
save_button.click(
|
| 263 |
+
fn=save_chat_history,
|
| 264 |
+
inputs=[chatbot, username_input],
|
| 265 |
+
outputs=download_button
|
| 266 |
+
).then(
|
| 267 |
+
fn=lambda: gr.update(visible=True),
|
| 268 |
+
outputs=download_button
|
| 269 |
+
)
|
| 270 |
+
|
| 271 |
#launching chatbot
|
| 272 |
demo.launch()
|
| 273 |
|