Update app.py
Browse files
app.py
CHANGED
|
@@ -360,7 +360,7 @@ def generate_auswahl(prompt_in, file, file_history, chatbot, history, anzahl_doc
|
|
| 360 |
########################################
|
| 361 |
# Hochladen von Dateien und Vektorstore neu erstellen
|
| 362 |
# Beispiel-Upload-PDF-Funktion
|
| 363 |
-
|
| 364 |
def upload_pdf(files):
|
| 365 |
if not files:
|
| 366 |
logging.warning("No files uploaded.")
|
|
@@ -447,8 +447,12 @@ def upload_pdf(files):
|
|
| 447 |
|
| 448 |
except Exception as e:
|
| 449 |
logging.error(f"Error uploading file {file.name}: {e}")
|
| 450 |
-
|
| 451 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 452 |
try:
|
| 453 |
############################################
|
| 454 |
#Vektorstore neu....
|
|
@@ -460,10 +464,6 @@ def upload_pdf(files):
|
|
| 460 |
logging.error(f"Error renewing Vektorstore: {e}")
|
| 461 |
status_message += " - Fehler beim Erneuern des Vektorstores."
|
| 462 |
|
| 463 |
-
return status_message, display_files()
|
| 464 |
-
"""
|
| 465 |
-
|
| 466 |
-
|
| 467 |
|
| 468 |
########################################
|
| 469 |
# Bot- test gegen schädliche Bots die die Anwendung testen...
|
|
@@ -709,8 +709,12 @@ with gr.Blocks(css=customCSS, theme=themeAlex) as demo:
|
|
| 709 |
cancelBtn.click(cancel_outputing, [], [status_display], cancels=[predict_event1,predict_event2, predict_event3])
|
| 710 |
############################################
|
| 711 |
#2ter Tab
|
| 712 |
-
renew_button.click(fn=upload_pdf, inputs=upload_pdf_files, outputs=[output_text, file_list])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 713 |
demo.load(display_files, outputs=file_list)
|
| 714 |
|
| 715 |
-
demo.title = "KKG-
|
| 716 |
demo.queue(default_concurrency_limit=15).launch(debug=True)
|
|
|
|
| 360 |
########################################
|
| 361 |
# Hochladen von Dateien und Vektorstore neu erstellen
|
| 362 |
# Beispiel-Upload-PDF-Funktion
|
| 363 |
+
"""
|
| 364 |
def upload_pdf(files):
|
| 365 |
if not files:
|
| 366 |
logging.warning("No files uploaded.")
|
|
|
|
| 447 |
|
| 448 |
except Exception as e:
|
| 449 |
logging.error(f"Error uploading file {file.name}: {e}")
|
| 450 |
+
|
| 451 |
+
|
| 452 |
+
return status_message, display_files()
|
| 453 |
+
|
| 454 |
+
# Nachdem alle Dateien hochgeladen wurden, den Vektorstore neu laden
|
| 455 |
+
def update_vectorstore():
|
| 456 |
try:
|
| 457 |
############################################
|
| 458 |
#Vektorstore neu....
|
|
|
|
| 464 |
logging.error(f"Error renewing Vektorstore: {e}")
|
| 465 |
status_message += " - Fehler beim Erneuern des Vektorstores."
|
| 466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
|
| 468 |
########################################
|
| 469 |
# Bot- test gegen schädliche Bots die die Anwendung testen...
|
|
|
|
| 709 |
cancelBtn.click(cancel_outputing, [], [status_display], cancels=[predict_event1,predict_event2, predict_event3])
|
| 710 |
############################################
|
| 711 |
#2ter Tab
|
| 712 |
+
#renew_button.click(fn=upload_pdf, inputs=upload_pdf_files, outputs=[output_text, file_list])
|
| 713 |
+
# Hochladen der Dateien und dann Vektorstore aktualisieren
|
| 714 |
+
renew_button.click(fn=upload_pdf, inputs=upload_pdf_files, outputs=[output_text, file_list]).then(
|
| 715 |
+
fn=update_vectorstore, inputs=None, outputs=output_text
|
| 716 |
+
)
|
| 717 |
demo.load(display_files, outputs=file_list)
|
| 718 |
|
| 719 |
+
demo.title = "KKG-Suche"
|
| 720 |
demo.queue(default_concurrency_limit=15).launch(debug=True)
|