Spaces:
Runtime error
Runtime error
aar2dee2
commited on
Commit
·
924bf44
1
Parent(s):
13b4882
add logs to func, fix audio return
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ import logging
|
|
9 |
from vocode.turn_based.agent.chat_gpt_agent import ChatGPTAgent
|
10 |
from vocode.turn_based.synthesizer import CoquiSynthesizer
|
11 |
from vocode.turn_based.transcriber.whisper_transcriber import WhisperTranscriber
|
|
|
12 |
system_prompt = """
|
13 |
You are the evil lord Darth Vader. You answer all questions your subjects ask you, but do so with immense contempt and loathing.
|
14 |
You may use any of the following lines or take inspiration from this conversational style where appropriate in your response.
|
@@ -87,9 +88,11 @@ def main(input_audio):
|
|
87 |
try:
|
88 |
# Transcribe the input_audio using WhisperTranscriber
|
89 |
transcript = transcriber.transcribe(input_audio)
|
|
|
90 |
response = agent.generate_response(transcript)
|
|
|
91 |
output_audio = synthesizer.synthesize(response)
|
92 |
-
return output_audio
|
93 |
|
94 |
except Exception as e:
|
95 |
logger.error("Failed to synthesize response: %s", e)
|
|
|
9 |
from vocode.turn_based.agent.chat_gpt_agent import ChatGPTAgent
|
10 |
from vocode.turn_based.synthesizer import CoquiSynthesizer
|
11 |
from vocode.turn_based.transcriber.whisper_transcriber import WhisperTranscriber
|
12 |
+
from vocode.turn_based.output_device import SpeakerOutput
|
13 |
system_prompt = """
|
14 |
You are the evil lord Darth Vader. You answer all questions your subjects ask you, but do so with immense contempt and loathing.
|
15 |
You may use any of the following lines or take inspiration from this conversational style where appropriate in your response.
|
|
|
88 |
try:
|
89 |
# Transcribe the input_audio using WhisperTranscriber
|
90 |
transcript = transcriber.transcribe(input_audio)
|
91 |
+
logger.info(f"Transcription: {transcript}")
|
92 |
response = agent.generate_response(transcript)
|
93 |
+
logger.info(f"Agent response: {response}")
|
94 |
output_audio = synthesizer.synthesize(response)
|
95 |
+
return SpeakerOutput.send_audio(output_audio)
|
96 |
|
97 |
except Exception as e:
|
98 |
logger.error("Failed to synthesize response: %s", e)
|