alexkueck commited on
Commit
51cae66
1 Parent(s): d98da6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -3
app.py CHANGED
@@ -419,11 +419,16 @@ 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
 
428
  ########################################
429
  # Bot- test gegen schädliche Bots die die Anwendung testen...
@@ -444,6 +449,18 @@ def custom_css():
444
  background-color: #303030; /* Dunkler Hintergrund */
445
  color:#353535;
446
  }
 
 
 
 
 
 
 
 
 
 
 
 
447
  """
448
 
449
 
@@ -587,7 +604,8 @@ with gr.Blocks(css=customCSS, theme=themeAlex) as demo:
587
 
588
  with gr.Tab("Datei hochladen"):
589
  upload_pdf_files = gr.Files(label="PDF- oder Word-Dateien in Zwischenablage", file_count="multiple")
590
- output_text = gr.Textbox(label="Status")
 
591
  renew_button = gr.Button("Dateien hochladen und System aktualisieren", elem_id="renew_button")
592
  file_list = gr.HTML(elem_id="file_list", show_label=False)
593
 
@@ -652,7 +670,9 @@ with gr.Blocks(css=customCSS, theme=themeAlex) as demo:
652
  renew_button.click(fn=upload_pdf, inputs=upload_pdf_files, outputs=[output_text, file_list]).then(
653
  fn=update_vectorstore, inputs=None, outputs=output_text).then(
654
  fn=reset_file_input, inputs=None, outputs=upload_pdf_files).then(
655
- fn= show_notification, inputs=None) #lambda: gr.Notification("System-Aktualisierung erfolgreich abgeschlossen!"
 
 
656
  demo.load(display_files, outputs=file_list)
657
 
658
  demo.title = "KKG-Suche"
 
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_message():
428
+ return gr.update(visible=True, value="System erfolgreich aktualisiert!")
429
 
430
+ def hide_message():
431
+ return gr.update(visible=False)
432
 
433
  ########################################
434
  # Bot- test gegen schädliche Bots die die Anwendung testen...
 
449
  background-color: #303030; /* Dunkler Hintergrund */
450
  color:#353535;
451
  }
452
+
453
+ #popup_message {
454
+ position: fixed;
455
+ top: 50%;
456
+ left: 50%;
457
+ transform: translate(-50%, -50%);
458
+ background-color: #f0f0f0;
459
+ padding: 20px;
460
+ border-radius: 10px;
461
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
462
+ z-index: 1000;
463
+ }
464
  """
465
 
466
 
 
604
 
605
  with gr.Tab("Datei hochladen"):
606
  upload_pdf_files = gr.Files(label="PDF- oder Word-Dateien in Zwischenablage", file_count="multiple")
607
+ output_text = gr.Textbox(label="Status", visible = False)
608
+ message = gr.Markdown(visible=False, elem_id="popup_message")
609
  renew_button = gr.Button("Dateien hochladen und System aktualisieren", elem_id="renew_button")
610
  file_list = gr.HTML(elem_id="file_list", show_label=False)
611
 
 
670
  renew_button.click(fn=upload_pdf, inputs=upload_pdf_files, outputs=[output_text, file_list]).then(
671
  fn=update_vectorstore, inputs=None, outputs=output_text).then(
672
  fn=reset_file_input, inputs=None, outputs=upload_pdf_files).then(
673
+ fn=hide_message, inputs=None, outputs=message, _js="() => new Promise(resolve => setTimeout(resolve, 3000))")
674
+
675
+ #fn= show_notification, inputs=None) #lambda: gr.Notification("System-Aktualisierung erfolgreich abgeschlossen!"
676
  demo.load(display_files, outputs=file_list)
677
 
678
  demo.title = "KKG-Suche"