Update app.py
Browse files
app.py
CHANGED
@@ -105,6 +105,14 @@ def upload_pdf(file):
|
|
105 |
)
|
106 |
return f"PDF '{filename}' erfolgreich hochgeladen."
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
def list_pdfs():
|
110 |
if not os.path.exists(SAVE_DIR):
|
@@ -277,8 +285,10 @@ with gr.Blocks(css="""
|
|
277 |
upload_pdf_file = gr.File(label="PDF- oder Word-Datei hochladen")
|
278 |
output_text = gr.Textbox(label="Status")
|
279 |
upload_button = gr.Button("Datei hochladen")
|
|
|
280 |
|
281 |
upload_button.click(fn=upload_pdf, inputs=upload_pdf_file, outputs=output_text)
|
|
|
282 |
|
283 |
|
284 |
|
|
|
105 |
)
|
106 |
return f"PDF '{filename}' erfolgreich hochgeladen."
|
107 |
|
108 |
+
def display_files():
|
109 |
+
files = os.listdir(DOCS_DIR)
|
110 |
+
files_list = "<ul>"
|
111 |
+
for file in files:
|
112 |
+
files_list += f"<li>{file}</li>"
|
113 |
+
files_list += "</ul>"
|
114 |
+
return files_list
|
115 |
+
|
116 |
|
117 |
def list_pdfs():
|
118 |
if not os.path.exists(SAVE_DIR):
|
|
|
285 |
upload_pdf_file = gr.File(label="PDF- oder Word-Datei hochladen")
|
286 |
output_text = gr.Textbox(label="Status")
|
287 |
upload_button = gr.Button("Datei hochladen")
|
288 |
+
file_list = gr.HTML(elem_id="file_list", show_label=False)
|
289 |
|
290 |
upload_button.click(fn=upload_pdf, inputs=upload_pdf_file, outputs=output_text)
|
291 |
+
gr.HTML(update=display_files, elem_id="file_list", show_label=False)
|
292 |
|
293 |
|
294 |
|