Update app.py
Browse files
app.py
CHANGED
|
@@ -134,8 +134,9 @@ os.environ["HUGGINGFACEHUB_API_TOKEN"] = HUGGINGFACEHUB_API_TOKEN
|
|
| 134 |
|
| 135 |
##############################################
|
| 136 |
#wenn löschen Button geklickt
|
| 137 |
-
def clear_all():
|
| 138 |
-
|
|
|
|
| 139 |
|
| 140 |
##############################################
|
| 141 |
#History - die Frage oder das File eintragen...
|
|
@@ -578,6 +579,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 578 |
user_question = gr.State("")
|
| 579 |
#damit der Prompt auch nach dem upload in die History noch für predicts_args verfügbar ist
|
| 580 |
user_question2 = gr.State("")
|
|
|
|
| 581 |
################################################
|
| 582 |
# Tab zum Chatbot mit Text oder Bildeingabe
|
| 583 |
################################################
|
|
@@ -601,10 +603,10 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 601 |
with gr.Column(min_width=70, scale=1):
|
| 602 |
cancelBtn = gr.Button("Stop")
|
| 603 |
with gr.Row():
|
| 604 |
-
file_display = gr.File(visible=False)
|
| 605 |
image_display = gr.Image( visible=False)
|
| 606 |
upload = gr.UploadButton("📁", file_types=["image", "video", "audio"], scale = 10)
|
| 607 |
-
emptyBtn = gr.ClearButton([user_input, chatbot, history,
|
| 608 |
|
| 609 |
with gr.Column():
|
| 610 |
with gr.Column(min_width=50, scale=1):
|
|
@@ -715,8 +717,8 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 715 |
|
| 716 |
predict_event1 = user_input.submit(**transfer_input_args, queue=False,).then(**predict_args)
|
| 717 |
predict_event2 = submitBtn.click(**transfer_input_args, queue=False,).then(**predict_args)
|
| 718 |
-
predict_event3 = upload.upload(file_anzeigen, [upload], [image_display, image_display,
|
| 719 |
-
emptyBtn.click(clear_all, [], [
|
| 720 |
|
| 721 |
#Berechnung oder Ausgabe anhalten (kann danach fortgesetzt werden)
|
| 722 |
cancelBtn.click(cancel_outputing, [], [status_display], cancels=[predict_event1,predict_event2, predict_event3])
|
|
|
|
| 134 |
|
| 135 |
##############################################
|
| 136 |
#wenn löschen Button geklickt
|
| 137 |
+
def clear_all(file):
|
| 138 |
+
file = None
|
| 139 |
+
return gr.Image(visible=False)
|
| 140 |
|
| 141 |
##############################################
|
| 142 |
#History - die Frage oder das File eintragen...
|
|
|
|
| 579 |
user_question = gr.State("")
|
| 580 |
#damit der Prompt auch nach dem upload in die History noch für predicts_args verfügbar ist
|
| 581 |
user_question2 = gr.State("")
|
| 582 |
+
attached_file = gr.State(None)
|
| 583 |
################################################
|
| 584 |
# Tab zum Chatbot mit Text oder Bildeingabe
|
| 585 |
################################################
|
|
|
|
| 603 |
with gr.Column(min_width=70, scale=1):
|
| 604 |
cancelBtn = gr.Button("Stop")
|
| 605 |
with gr.Row():
|
| 606 |
+
#file_display = gr.File(visible=False)
|
| 607 |
image_display = gr.Image( visible=False)
|
| 608 |
upload = gr.UploadButton("📁", file_types=["image", "video", "audio"], scale = 10)
|
| 609 |
+
emptyBtn = gr.ClearButton([user_input, chatbot, history, attached_file, image_display], value="🧹 Neue Session", scale=10)
|
| 610 |
|
| 611 |
with gr.Column():
|
| 612 |
with gr.Column(min_width=50, scale=1):
|
|
|
|
| 717 |
|
| 718 |
predict_event1 = user_input.submit(**transfer_input_args, queue=False,).then(**predict_args)
|
| 719 |
predict_event2 = submitBtn.click(**transfer_input_args, queue=False,).then(**predict_args)
|
| 720 |
+
predict_event3 = upload.upload(file_anzeigen, [upload], [image_display, image_display, attached_file] ) #.then(**predict_args)
|
| 721 |
+
#emptyBtn.click(clear_all, [], [attached_file, image_display])
|
| 722 |
|
| 723 |
#Berechnung oder Ausgabe anhalten (kann danach fortgesetzt werden)
|
| 724 |
cancelBtn.click(cancel_outputing, [], [status_display], cancels=[predict_event1,predict_event2, predict_event3])
|