Update app.py
Browse files
app.py
CHANGED
|
@@ -107,7 +107,7 @@ os.environ["HUGGINGFACEHUB_API_TOKEN"] = HUGGINGFACEHUB_API_TOKEN
|
|
| 107 |
##############################################
|
| 108 |
#wenn löschen Button geklickt
|
| 109 |
def clear_all():
|
| 110 |
-
return None, gr.
|
| 111 |
|
| 112 |
##############################################
|
| 113 |
#History - die Frage oder das File eintragen...
|
|
@@ -121,7 +121,7 @@ def add_text(chatbot, history, prompt, file):
|
|
| 121 |
chatbot = chatbot +[((file.name,), None), (prompt, None)]
|
| 122 |
print("chatbot nach add_text............")
|
| 123 |
print(chatbot)
|
| 124 |
-
return chatbot, history, prompt, file, gr.
|
| 125 |
|
| 126 |
def add_text2(chatbot, prompt):
|
| 127 |
if (prompt == ""):
|
|
@@ -136,13 +136,13 @@ def add_text2(chatbot, prompt):
|
|
| 136 |
#nach dem Upload soll das zusätzliche Fenster mit dem image drinnen angezeigt werden
|
| 137 |
def file_anzeigen(file):
|
| 138 |
ext = analyze_file(file)
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
|
| 144 |
def file_loeschen():
|
| 145 |
-
return None, gr.
|
| 146 |
|
| 147 |
############################################
|
| 148 |
#wenn 'Stop' Button geklickt, dann Message dazu und das Eingabe-Fenster leeren
|
|
@@ -470,7 +470,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 470 |
cancelBtn = gr.Button("Stop")
|
| 471 |
with gr.Row():
|
| 472 |
#file_display = gr.File(visible=False)
|
| 473 |
-
image_display = gr.
|
| 474 |
upload = gr.UploadButton("📁", file_types=["image", "pdf", "docx", "pptx", "xlsx"], scale = 10)
|
| 475 |
emptyBtn = gr.ClearButton([user_input, chatbot, history, attached_file, image_display], value="🧹 Neue Session", scale=10)
|
| 476 |
|
|
|
|
| 107 |
##############################################
|
| 108 |
#wenn löschen Button geklickt
|
| 109 |
def clear_all():
|
| 110 |
+
return None, gr.Image(visible=False), []
|
| 111 |
|
| 112 |
##############################################
|
| 113 |
#History - die Frage oder das File eintragen...
|
|
|
|
| 121 |
chatbot = chatbot +[((file.name,), None), (prompt, None)]
|
| 122 |
print("chatbot nach add_text............")
|
| 123 |
print(chatbot)
|
| 124 |
+
return chatbot, history, prompt, file, gr.Image(visible = False), "" #gr.Image( label=None, size=(30,30), visible=False, scale=1) #gr.Textbox(value="", interactive=False)
|
| 125 |
|
| 126 |
def add_text2(chatbot, prompt):
|
| 127 |
if (prompt == ""):
|
|
|
|
| 136 |
#nach dem Upload soll das zusätzliche Fenster mit dem image drinnen angezeigt werden
|
| 137 |
def file_anzeigen(file):
|
| 138 |
ext = analyze_file(file)
|
| 139 |
+
if (ext == "png" or ext == "PNG" or ext == "jgp" or ext == "jepg"):
|
| 140 |
+
return gr.Image(width=47, visible=True, interactive = False, height=47, min_width=47, show_label=False, scale = 0.5), file, file
|
| 141 |
+
else:
|
| 142 |
+
return gr.Image(width=47, visible=True, interactive = False, height=47, min_width=47, show_label=False, scale = 0.5), file, file
|
| 143 |
|
| 144 |
def file_loeschen():
|
| 145 |
+
return None, gr.Image(visible = False)
|
| 146 |
|
| 147 |
############################################
|
| 148 |
#wenn 'Stop' Button geklickt, dann Message dazu und das Eingabe-Fenster leeren
|
|
|
|
| 470 |
cancelBtn = gr.Button("Stop")
|
| 471 |
with gr.Row():
|
| 472 |
#file_display = gr.File(visible=False)
|
| 473 |
+
image_display = gr.Image( visible=False)
|
| 474 |
upload = gr.UploadButton("📁", file_types=["image", "pdf", "docx", "pptx", "xlsx"], scale = 10)
|
| 475 |
emptyBtn = gr.ClearButton([user_input, chatbot, history, attached_file, image_display], value="🧹 Neue Session", scale=10)
|
| 476 |
|