Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -149,14 +149,7 @@ def search_similar_documents(prompt):
|
|
149 |
|
150 |
return "\n".join(formatted_results)
|
151 |
|
152 |
-
|
153 |
-
with gr.Blocks() as demo:
|
154 |
-
gr.Markdown("# PDF Upload and Similarity Search with ChromaDB and LLM")
|
155 |
-
with gr.Row():
|
156 |
-
file_input = gr.File(label="Wähle eine PDF-Datei aus", type="filepath")
|
157 |
-
upload_output = gr.Textbox(label="Upload Status")
|
158 |
-
with gr.Row():
|
159 |
-
submit_button = gr.Button("upload")
|
160 |
with gr.Row():
|
161 |
prompt_input = gr.Textbox(label="Suche nach ähnlichen Dokumenten", placeholder="Gib einen Suchbegriff ein")
|
162 |
search_output = gr.Textbox(label="Ähnliche Dokumente")
|
@@ -168,9 +161,26 @@ with gr.Blocks() as demo:
|
|
168 |
with gr.Row():
|
169 |
llm_submit_button = gr.Button("send")
|
170 |
|
171 |
-
submit_button.click(process_pdf, inputs=file_input, outputs=upload_output)
|
172 |
search_button.click(search_similar_documents, inputs=prompt_input, outputs=search_output)
|
173 |
llm_submit_button.click(ask_llm, inputs=llm_prompt_input, outputs=llm_output)
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
# Starte die Gradio-Anwendung
|
176 |
demo.launch()
|
|
|
149 |
|
150 |
return "\n".join(formatted_results)
|
151 |
|
152 |
+
with gr.Blocks() as chat:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
with gr.Row():
|
154 |
prompt_input = gr.Textbox(label="Suche nach ähnlichen Dokumenten", placeholder="Gib einen Suchbegriff ein")
|
155 |
search_output = gr.Textbox(label="Ähnliche Dokumente")
|
|
|
161 |
with gr.Row():
|
162 |
llm_submit_button = gr.Button("send")
|
163 |
|
|
|
164 |
search_button.click(search_similar_documents, inputs=prompt_input, outputs=search_output)
|
165 |
llm_submit_button.click(ask_llm, inputs=llm_prompt_input, outputs=llm_output)
|
166 |
|
167 |
+
with gr.Blocks() as upload:
|
168 |
+
with gr.Row():
|
169 |
+
file_input = gr.File(label="Wähle eine PDF-Datei aus", type="filepath")
|
170 |
+
upload_output = gr.Textbox(label="Upload Status")
|
171 |
+
with gr.Row():
|
172 |
+
submit_button = gr.Button("upload")
|
173 |
+
submit_button.click(process_pdf, inputs=file_input, outputs=upload_output)
|
174 |
+
|
175 |
+
|
176 |
+
|
177 |
+
# Erstelle die Gradio-Schnittstelle
|
178 |
+
with gr.Blocks() as demo:
|
179 |
+
gr.TabbedInterface(
|
180 |
+
[chat, upload]
|
181 |
+
)
|
182 |
+
|
183 |
+
|
184 |
+
|
185 |
# Starte die Gradio-Anwendung
|
186 |
demo.launch()
|