Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -276,6 +276,14 @@ def add_file(history, file, prompt):
|
|
| 276 |
history = history + [((file.name,), None), (prompt, None)]
|
| 277 |
return history, ""
|
| 278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
##############################################
|
| 280 |
##############################################
|
| 281 |
##############################################
|
|
@@ -479,10 +487,10 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 479 |
|
| 480 |
# Chatbot
|
| 481 |
transfer_input_args = dict(
|
| 482 |
-
fn=add_text, inputs=[
|
| 483 |
)
|
| 484 |
|
| 485 |
-
|
| 486 |
predict_event3 = btn.upload(add_file, [chatbot, btn, user_input], [chatbot, user_input],queue=False,).then(**predict_args)
|
| 487 |
predict_event2 = submitBtn.click(**transfer_input_args,queue=False,).then(**predict_args)
|
| 488 |
|
|
|
|
| 276 |
history = history + [((file.name,), None), (prompt, None)]
|
| 277 |
return history, ""
|
| 278 |
|
| 279 |
+
def transfer_input(inputs):
|
| 280 |
+
textbox = reset_textbox()
|
| 281 |
+
return (
|
| 282 |
+
inputs,
|
| 283 |
+
gr.update(value=""),
|
| 284 |
+
gr.Button.update(visible=True),
|
| 285 |
+
)
|
| 286 |
+
|
| 287 |
##############################################
|
| 288 |
##############################################
|
| 289 |
##############################################
|
|
|
|
| 487 |
|
| 488 |
# Chatbot
|
| 489 |
transfer_input_args = dict(
|
| 490 |
+
fn=add_text, inputs=[chatbot, user_input], outputs=[chatbot, user_input], show_progress=True
|
| 491 |
)
|
| 492 |
|
| 493 |
+
predict_event1 = user_input.submit(**transfer_input_args,queue=False,).then(**predict_args)
|
| 494 |
predict_event3 = btn.upload(add_file, [chatbot, btn, user_input], [chatbot, user_input],queue=False,).then(**predict_args)
|
| 495 |
predict_event2 = submitBtn.click(**transfer_input_args,queue=False,).then(**predict_args)
|
| 496 |
|