alexkueck commited on
Commit
8dfaea5
1 Parent(s): f489ec0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -419,19 +419,20 @@ def update_vectorstore():
419
  def reset_file_input():
420
  # Zurücksetzen des file inputs
421
  return gr.update(value=None)
422
- """
423
- def show_notification():
424
- print("Funktion wurde aufgerufen")
425
- return gr.Notification("System erfolgreich aktualisiert!", title="Fertig", type="info") #gr.Info("System erfolgreich aktualisiert!") #
426
- """
427
  def show_success():
428
  return gr.Info( "System erfolgreich aktualisiert!")
429
 
430
  def hide_status():
431
- return gr.Textbox( visible = False)
432
 
433
  def show_status():
434
- return gr.Textbox( label="Status", visible = True)
 
 
 
 
435
 
436
  ########################################
437
  # Bot- test gegen schädliche Bots die die Anwendung testen...
@@ -595,7 +596,7 @@ with gr.Blocks(css=customCSS, theme=themeAlex) as demo:
595
 
596
  with gr.Tab("Datei hochladen"):
597
  upload_pdf_files = gr.Files(label="PDF- oder Word-Dateien in Zwischenablage", file_count="multiple")
598
- output_text = gr.Textbox(label="Status", visible = False)
599
  message = gr.Markdown(visible=False, elem_id="popup_message")
600
  renew_button = gr.Button("Dateien hochladen und System aktualisieren", elem_id="renew_button")
601
  file_list = gr.HTML(elem_id="file_list", show_label=False)
@@ -660,7 +661,7 @@ with gr.Blocks(css=customCSS, theme=themeAlex) as demo:
660
  # Hochladen der Dateien und dann Vektorstore aktualisieren
661
  renew_button.click(fn=upload_pdf, inputs=upload_pdf_files, outputs=[output_text, file_list]).then(
662
  fn=update_vectorstore, inputs=None, outputs=output_text).then(
663
- fn=reset_file_input, inputs=None, outputs=upload_pdf_files).then(fn=hide_status, inputs=None, outputs=output_text).success(
664
  fn=show_success)
665
 
666
  #fn= show_notification, inputs=None) #lambda: gr.Notification("System-Aktualisierung erfolgreich abgeschlossen!"
 
419
  def reset_file_input():
420
  # Zurücksetzen des file inputs
421
  return gr.update(value=None)
422
+
423
+ # Für die Sttus Anzeige während und Nach File Upload und Vektordatenbank aktualisierung
 
 
 
424
  def show_success():
425
  return gr.Info( "System erfolgreich aktualisiert!")
426
 
427
  def hide_status():
428
+ return gr.HTML(value="", label="Status", visible=False) #gr.Textbox( visible = False)
429
 
430
  def show_status():
431
+ return gr.HTML(value="", label="Status", visible=True) ##gr.Textbox( label="Status", visible = True)
432
+
433
+ def show_text_status():
434
+ time.sleep(3)
435
+ return gr.HTML(value="System erfolgreich aktualisiert!", label="Status", visible=True)
436
 
437
  ########################################
438
  # Bot- test gegen schädliche Bots die die Anwendung testen...
 
596
 
597
  with gr.Tab("Datei hochladen"):
598
  upload_pdf_files = gr.Files(label="PDF- oder Word-Dateien in Zwischenablage", file_count="multiple")
599
+ output_text = gr.HTML(value="", label="Status") #gr.Textbox(label="Status", visible = False)
600
  message = gr.Markdown(visible=False, elem_id="popup_message")
601
  renew_button = gr.Button("Dateien hochladen und System aktualisieren", elem_id="renew_button")
602
  file_list = gr.HTML(elem_id="file_list", show_label=False)
 
661
  # Hochladen der Dateien und dann Vektorstore aktualisieren
662
  renew_button.click(fn=upload_pdf, inputs=upload_pdf_files, outputs=[output_text, file_list]).then(
663
  fn=update_vectorstore, inputs=None, outputs=output_text).then(
664
+ fn=reset_file_input, inputs=None, outputs=upload_pdf_files).then(fn=show_text_status, inputs=None, outputs=output_text).success(
665
  fn=show_success)
666
 
667
  #fn= show_notification, inputs=None) #lambda: gr.Notification("System-Aktualisierung erfolgreich abgeschlossen!"