Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -231,18 +231,24 @@ def retriever(question: str):
|
|
231 |
|
232 |
|
233 |
# Function to handle the entire audio query and response process
|
234 |
-
def process_audio_query(audio_input):
|
235 |
stream = None
|
|
|
236 |
_, transcription, _ = transcribe_function(stream, audio_input)
|
237 |
print(f"Transcription: {transcription}")
|
238 |
-
|
239 |
-
# Retrieve
|
240 |
response_text = retriever(transcription)
|
241 |
print(f"Response: {response_text}")
|
242 |
-
|
243 |
# Generate audio from the response text
|
244 |
audio_path = generate_audio_elevenlabs(response_text)
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
246 |
|
247 |
|
248 |
|
|
|
231 |
|
232 |
|
233 |
# Function to handle the entire audio query and response process
|
234 |
+
def process_audio_query(audio_input, state):
|
235 |
stream = None
|
236 |
+
# Process the audio input and get the transcription
|
237 |
_, transcription, _ = transcribe_function(stream, audio_input)
|
238 |
print(f"Transcription: {transcription}")
|
239 |
+
|
240 |
+
# Retrieve a response based on the transcription
|
241 |
response_text = retriever(transcription)
|
242 |
print(f"Response: {response_text}")
|
243 |
+
|
244 |
# Generate audio from the response text
|
245 |
audio_path = generate_audio_elevenlabs(response_text)
|
246 |
+
|
247 |
+
# Update the conversation history in the state
|
248 |
+
state.conversation.append((transcription, response_text))
|
249 |
+
|
250 |
+
# Return the path of the audio and the updated state
|
251 |
+
return audio_path, state
|
252 |
|
253 |
|
254 |
|