Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,22 +61,25 @@ AUDIO_OUTPUT_PATH = "/tmp/response.mp3"
|
|
| 61 |
@tool
|
| 62 |
def text_to_speech(text: str) -> AgentAudio:
|
| 63 |
"""
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
Parameters
|
| 67 |
-
----------
|
| 68 |
-
text : str
|
| 69 |
-
The text to be converted into speech.
|
| 70 |
-
|
| 71 |
-
Returns
|
| 72 |
-
-------
|
| 73 |
-
AgentAudio
|
| 74 |
-
An instance containing the path to the generated audio file.
|
| 75 |
"""
|
| 76 |
tts = gTTS(text=text, lang='en')
|
| 77 |
tts.save(AUDIO_OUTPUT_PATH)
|
| 78 |
return AgentAudio(AUDIO_OUTPUT_PATH)
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
# # Define the audio output path
|
| 82 |
# AUDIO_OUTPUT_PATH = "/tmp/response.mp3"
|
|
|
|
| 61 |
@tool
|
| 62 |
def text_to_speech(text: str) -> AgentAudio:
|
| 63 |
"""
|
| 64 |
+
Temporary placeholder docstring.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
"""
|
| 66 |
tts = gTTS(text=text, lang='en')
|
| 67 |
tts.save(AUDIO_OUTPUT_PATH)
|
| 68 |
return AgentAudio(AUDIO_OUTPUT_PATH)
|
| 69 |
|
| 70 |
+
# Immediately after its definition, update the __doc__ attribute:
|
| 71 |
+
text_to_speech.__doc__ = (
|
| 72 |
+
"Convert text to speech and return the generated audio.\n\n"
|
| 73 |
+
"Parameters\n"
|
| 74 |
+
"----------\n"
|
| 75 |
+
"text : str\n"
|
| 76 |
+
" The text to be converted into speech.\n\n"
|
| 77 |
+
"Returns\n"
|
| 78 |
+
"-------\n"
|
| 79 |
+
"AgentAudio\n"
|
| 80 |
+
" An instance containing the path to the generated audio file."
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
|
| 84 |
# # Define the audio output path
|
| 85 |
# AUDIO_OUTPUT_PATH = "/tmp/response.mp3"
|