Update app.py
Browse files
app.py
CHANGED
|
@@ -126,11 +126,11 @@ def clear_all():
|
|
| 126 |
|
| 127 |
##############################################
|
| 128 |
#History - die Frage oder das File eintragen...
|
| 129 |
-
def add_text(chatbot, history, prompt, file):
|
| 130 |
if (file == None):
|
| 131 |
chatbot = chatbot +[(prompt, None)]
|
| 132 |
else:
|
| 133 |
-
|
| 134 |
if (prompt == ""):
|
| 135 |
chatbot=chatbot + [((file.name,), "Prompt fehlt!")]
|
| 136 |
else:
|
|
@@ -140,7 +140,7 @@ def add_text(chatbot, history, prompt, file):
|
|
| 140 |
else:
|
| 141 |
chatbot = chatbot +[("Hochgeladenes Dokument: "+ get_filename(file) +"\n" + prompt, None)]
|
| 142 |
|
| 143 |
-
return chatbot, history, prompt, file,
|
| 144 |
|
| 145 |
def add_text2(chatbot, prompt):
|
| 146 |
if (prompt == ""):
|
|
@@ -637,7 +637,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 637 |
|
| 638 |
# Chatbot
|
| 639 |
transfer_input_args = dict(
|
| 640 |
-
fn=add_text, inputs=[chatbot, history, user_input, attached_file], outputs=[chatbot, history, user_question, attached_file, attached_file_history, image_display , user_input], show_progress=True
|
| 641 |
)
|
| 642 |
|
| 643 |
predict_event1 = user_input.submit(**transfer_input_args, queue=False,).then(**predict_args)
|
|
|
|
| 126 |
|
| 127 |
##############################################
|
| 128 |
#History - die Frage oder das File eintragen...
|
| 129 |
+
def add_text(chatbot, history, prompt, file, file_history):
|
| 130 |
if (file == None):
|
| 131 |
chatbot = chatbot +[(prompt, None)]
|
| 132 |
else:
|
| 133 |
+
file_history = file
|
| 134 |
if (prompt == ""):
|
| 135 |
chatbot=chatbot + [((file.name,), "Prompt fehlt!")]
|
| 136 |
else:
|
|
|
|
| 140 |
else:
|
| 141 |
chatbot = chatbot +[("Hochgeladenes Dokument: "+ get_filename(file) +"\n" + prompt, None)]
|
| 142 |
|
| 143 |
+
return chatbot, history, prompt, file, file_history, gr.Image(visible = False), "" #gr.Image( label=None, size=(30,30), visible=False, scale=1) #gr.Textbox(value="", interactive=False)
|
| 144 |
|
| 145 |
def add_text2(chatbot, prompt):
|
| 146 |
if (prompt == ""):
|
|
|
|
| 637 |
|
| 638 |
# Chatbot
|
| 639 |
transfer_input_args = dict(
|
| 640 |
+
fn=add_text, inputs=[chatbot, history, user_input, attached_file, attached_file_history], outputs=[chatbot, history, user_question, attached_file, attached_file_history, image_display , user_input], show_progress=True
|
| 641 |
)
|
| 642 |
|
| 643 |
predict_event1 = user_input.submit(**transfer_input_args, queue=False,).then(**predict_args)
|