Update app.py
Browse files
app.py
CHANGED
|
@@ -414,11 +414,15 @@ def upload_pdf(file):
|
|
| 414 |
############################################
|
| 415 |
#Vektorstore neu....
|
| 416 |
############################################
|
| 417 |
-
create_vectorstore()
|
| 418 |
|
| 419 |
return f"PDF '{filename}' erfolgreich hochgeladen."
|
| 420 |
|
| 421 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
|
| 423 |
|
| 424 |
|
|
@@ -581,7 +585,22 @@ with gr.Blocks(css=customCSS, theme=themeAlex) as demo:
|
|
| 581 |
repetition_penalty=gr.Slider(label="Repetition penalty", value=1.2, minimum=1.0, maximum=2.0, step=0.05, interactive=True, info="Strafe für wiederholte Tokens", visible=False)
|
| 582 |
anzahl_docs = gr.Slider(label="Anzahl Dokumente", value=3, minimum=1, maximum=10, step=1, interactive=True, info="wie viele Dokumententeile aus dem Vektorstore an den prompt gehängt werden", visible=False)
|
| 583 |
openai_key = gr.Textbox(label = "OpenAI API Key", value = "sk-", lines = 1, visible = False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
with gr.Tab("Datei hochladen"):
|
| 586 |
upload_pdf_file = gr.File(label="PDF- oder Word-Datei hochladen")
|
| 587 |
output_text = gr.Textbox(label="Status")
|
|
@@ -593,7 +612,7 @@ with gr.Blocks(css=customCSS, theme=themeAlex) as demo:
|
|
| 593 |
upload_pdf_file.change(fn=upload_pdf, inputs=upload_pdf_file, outputs=output_text)
|
| 594 |
#gr.HTML(update=display_files, elem_id="file_list", show_label=False)
|
| 595 |
demo.load(display_files, outputs=file_list)
|
| 596 |
-
|
| 597 |
|
| 598 |
gr.Markdown(description)
|
| 599 |
|
|
|
|
| 414 |
############################################
|
| 415 |
#Vektorstore neu....
|
| 416 |
############################################
|
| 417 |
+
#create_vectorstore()
|
| 418 |
|
| 419 |
return f"PDF '{filename}' erfolgreich hochgeladen."
|
| 420 |
|
| 421 |
|
| 422 |
+
#Vektorstore erst auf ButtonKlick erneuern, vorher eventuell mehrere Dateien hochladen
|
| 423 |
+
def renew_vectorstore():
|
| 424 |
+
create_vectorstore()
|
| 425 |
+
return "Vektorstore wurde erfolgreich erneuert."
|
| 426 |
|
| 427 |
|
| 428 |
|
|
|
|
| 585 |
repetition_penalty=gr.Slider(label="Repetition penalty", value=1.2, minimum=1.0, maximum=2.0, step=0.05, interactive=True, info="Strafe für wiederholte Tokens", visible=False)
|
| 586 |
anzahl_docs = gr.Slider(label="Anzahl Dokumente", value=3, minimum=1, maximum=10, step=1, interactive=True, info="wie viele Dokumententeile aus dem Vektorstore an den prompt gehängt werden", visible=False)
|
| 587 |
openai_key = gr.Textbox(label = "OpenAI API Key", value = "sk-", lines = 1, visible = False)
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
with gr.Tab("Datei hochladen"):
|
| 591 |
+
upload_pdf_file = gr.File(label="PDF- oder Word-Datei hochladen")
|
| 592 |
+
output_text = gr.Textbox(label="Status")
|
| 593 |
+
renew_button = gr.Button("Vektorstore erneuern", elem_id="renew_button")
|
| 594 |
+
file_list = gr.HTML(elem_id="file_list", show_label=False)
|
| 595 |
|
| 596 |
+
# Automatisches Ausführen der Upload-Funktion, wenn eine Datei hochgeladen wird
|
| 597 |
+
upload_pdf_file.change(fn=upload_pdf, inputs=upload_pdf_file, outputs=output_text)
|
| 598 |
+
renew_button.click(fn=renew_vectorstore, outputs=output_text)
|
| 599 |
+
#gr.HTML(update=display_files, elem_id="file_list", show_label=False)
|
| 600 |
+
demo.load(display_files, outputs=file_list)
|
| 601 |
+
|
| 602 |
+
|
| 603 |
+
"""
|
| 604 |
with gr.Tab("Datei hochladen"):
|
| 605 |
upload_pdf_file = gr.File(label="PDF- oder Word-Datei hochladen")
|
| 606 |
output_text = gr.Textbox(label="Status")
|
|
|
|
| 612 |
upload_pdf_file.change(fn=upload_pdf, inputs=upload_pdf_file, outputs=output_text)
|
| 613 |
#gr.HTML(update=display_files, elem_id="file_list", show_label=False)
|
| 614 |
demo.load(display_files, outputs=file_list)
|
| 615 |
+
"""
|
| 616 |
|
| 617 |
gr.Markdown(description)
|
| 618 |
|