Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,6 @@ import pyttsx3
|
|
12 |
api_key = os.getenv('groq')
|
13 |
# Initialisiere ChromaDB
|
14 |
client_chroma = chromadb.Client()
|
15 |
-
#client_croma = chromadb.PersistentClient(path="/")
|
16 |
collection_name = "pdf_collection"
|
17 |
collection = client_chroma.get_or_create_collection(name=collection_name)
|
18 |
|
@@ -78,21 +77,9 @@ def ask_llm(llm_prompt_input):
|
|
78 |
|
79 |
# Füge die formatierten Ergebnisse zum Prompt hinzu
|
80 |
enriched_prompt = f"{llm_prompt_input}\n\n### Verwandte Informationen:\n{''.join(formatted_results)}"
|
81 |
-
#print(enriched_prompt)
|
82 |
result = update(enriched_prompt)
|
83 |
result=gr.Markdown(result)
|
84 |
return result
|
85 |
-
# Führe die Abfrage des LLM durch
|
86 |
-
result = client.predict(
|
87 |
-
query=enriched_prompt,
|
88 |
-
history=[],
|
89 |
-
system="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
|
90 |
-
api_name="/model_chat"
|
91 |
-
)
|
92 |
-
result = result[1]
|
93 |
-
result = result[0][1]
|
94 |
-
result=gr.Markdown(result)
|
95 |
-
return result
|
96 |
|
97 |
def process_pdf(file):
|
98 |
# Read the PDF content
|
@@ -182,25 +169,15 @@ with gr.Blocks() as speech:
|
|
182 |
sr_outputs = gr.Textbox(label="Antwort")
|
183 |
with gr.Row():
|
184 |
sr_inputs = gr.Microphone(type="filepath")
|
185 |
-
|
186 |
-
#sr_inputs = gr.Microphone(type="filepath")
|
187 |
-
#with gr.Row():
|
188 |
-
#audio_button = gr.Button("audio")
|
189 |
-
#audio_button.click(text_to_speech("guten tag wie geht es dir"))
|
190 |
sr_inputs.change(transcribe_audio, inputs=sr_inputs, outputs=sr_outputs)
|
191 |
-
|
192 |
-
#with gr.Row():
|
193 |
-
#submit_button = gr.Button("rec")
|
194 |
-
|
195 |
-
#submit_button.click(transcribe_audio, inputs=sr_inputs, outputs=sr_outputs)
|
196 |
-
|
197 |
|
198 |
# Erstelle die Gradio-Schnittstelle
|
199 |
with gr.Blocks() as demo:
|
200 |
gr.TabbedInterface(
|
201 |
[chat, upload, suche]
|
|
|
202 |
)
|
203 |
|
204 |
-
|
205 |
# Starte die Gradio-Anwendung
|
206 |
demo.launch()
|
|
|
12 |
api_key = os.getenv('groq')
|
13 |
# Initialisiere ChromaDB
|
14 |
client_chroma = chromadb.Client()
|
|
|
15 |
collection_name = "pdf_collection"
|
16 |
collection = client_chroma.get_or_create_collection(name=collection_name)
|
17 |
|
|
|
77 |
|
78 |
# Füge die formatierten Ergebnisse zum Prompt hinzu
|
79 |
enriched_prompt = f"{llm_prompt_input}\n\n### Verwandte Informationen:\n{''.join(formatted_results)}"
|
|
|
80 |
result = update(enriched_prompt)
|
81 |
result=gr.Markdown(result)
|
82 |
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
def process_pdf(file):
|
85 |
# Read the PDF content
|
|
|
169 |
sr_outputs = gr.Textbox(label="Antwort")
|
170 |
with gr.Row():
|
171 |
sr_inputs = gr.Microphone(type="filepath")
|
172 |
+
|
|
|
|
|
|
|
|
|
173 |
sr_inputs.change(transcribe_audio, inputs=sr_inputs, outputs=sr_outputs)
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
# Erstelle die Gradio-Schnittstelle
|
176 |
with gr.Blocks() as demo:
|
177 |
gr.TabbedInterface(
|
178 |
[chat, upload, suche]
|
179 |
+
["Chat", "Upload", "Suche"]
|
180 |
)
|
181 |
|
|
|
182 |
# Starte die Gradio-Anwendung
|
183 |
demo.launch()
|