Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -645,6 +645,7 @@ def transcribe(audio_file):
|
|
645 |
|
646 |
def transcribe_and_respond(audio_file, history, model, temperature, num_calls, use_web_search, document_selector):
|
647 |
transcription = transcribe(audio_file)
|
|
|
648 |
if transcription.startswith("Error in transcription:"):
|
649 |
return history + [(None, transcription)]
|
650 |
|
@@ -655,6 +656,7 @@ def transcribe_and_respond(audio_file, history, model, temperature, num_calls, u
|
|
655 |
query = transcription.strip()
|
656 |
else:
|
657 |
return history + [(None, "Error: Unexpected transcription format")]
|
|
|
658 |
|
659 |
# Use the transcription as the query
|
660 |
new_history = list(respond(query, history, model, temperature, num_calls, use_web_search, document_selector))
|
@@ -663,6 +665,7 @@ def transcribe_and_respond(audio_file, history, model, temperature, num_calls, u
|
|
663 |
if new_history and new_history[-1][0] != query:
|
664 |
new_history.append((query, new_history[-1][1]))
|
665 |
new_history[-2] = (None, new_history[-2][1]) # Remove duplicate response
|
|
|
666 |
|
667 |
return new_history
|
668 |
|
|
|
645 |
|
646 |
def transcribe_and_respond(audio_file, history, model, temperature, num_calls, use_web_search, document_selector):
|
647 |
transcription = transcribe(audio_file)
|
648 |
+
logging.info(f"Transcription result: {transcription}")
|
649 |
if transcription.startswith("Error in transcription:"):
|
650 |
return history + [(None, transcription)]
|
651 |
|
|
|
656 |
query = transcription.strip()
|
657 |
else:
|
658 |
return history + [(None, "Error: Unexpected transcription format")]
|
659 |
+
logging.info(f"Query extracted from transcription: {query}")
|
660 |
|
661 |
# Use the transcription as the query
|
662 |
new_history = list(respond(query, history, model, temperature, num_calls, use_web_search, document_selector))
|
|
|
665 |
if new_history and new_history[-1][0] != query:
|
666 |
new_history.append((query, new_history[-1][1]))
|
667 |
new_history[-2] = (None, new_history[-2][1]) # Remove duplicate response
|
668 |
+
logging.info(f"New history after response: {new_history}")
|
669 |
|
670 |
return new_history
|
671 |
|