Spaces:
Runtime error
Runtime error
aar2dee2
commited on
Commit
·
d5b603e
1
Parent(s):
f04d6e8
initiate speaker output class
Browse files
app.py
CHANGED
|
@@ -98,6 +98,8 @@ def main(input_audio):
|
|
| 98 |
api_key=getenv("COQUI_API_KEY"),
|
| 99 |
)
|
| 100 |
|
|
|
|
|
|
|
| 101 |
print("Starting conversation. Press Ctrl+C to exit.")
|
| 102 |
while True:
|
| 103 |
try:
|
|
@@ -108,7 +110,7 @@ def main(input_audio):
|
|
| 108 |
response = agent.respond(transcript)
|
| 109 |
logger.info(f"Agent response: {response}")
|
| 110 |
output_audio = synthesizer.synthesize(response)
|
| 111 |
-
return
|
| 112 |
|
| 113 |
except Exception as e:
|
| 114 |
logger.error("Failed to synthesize response: %s", e)
|
|
|
|
| 98 |
api_key=getenv("COQUI_API_KEY"),
|
| 99 |
)
|
| 100 |
|
| 101 |
+
speaker_output = SpeakerOutput.from_default_device()
|
| 102 |
+
|
| 103 |
print("Starting conversation. Press Ctrl+C to exit.")
|
| 104 |
while True:
|
| 105 |
try:
|
|
|
|
| 110 |
response = agent.respond(transcript)
|
| 111 |
logger.info(f"Agent response: {response}")
|
| 112 |
output_audio = synthesizer.synthesize(response)
|
| 113 |
+
return speaker_output.send_audio(output_audio)
|
| 114 |
|
| 115 |
except Exception as e:
|
| 116 |
logger.error("Failed to synthesize response: %s", e)
|