Pijush2023 commited on
Commit
7a0c9f7
·
verified ·
1 Parent(s): 93f1ece

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
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 hybrid response using Neo4j and other methods
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
- return audio_path
 
 
 
 
 
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