Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -53,12 +53,12 @@ def text_to_speech_kokoro(text: str, voice: str = 'af_heart', speed: float = 1.0
|
|
53 |
full_audio = np.concatenate(audio_segments)
|
54 |
sample_rate = 24000 # Kokoro outputs at 24 kHz
|
55 |
# Ensure the static folder exists and save the file there
|
56 |
-
os.makedirs("
|
57 |
-
filename = os.path.join("
|
58 |
sf.write(filename, full_audio, sample_rate)
|
59 |
# Return an AgentAudio object pointing to the relative URL of the audio file
|
60 |
from smolagents.agent_types import AgentAudio
|
61 |
-
return AgentAudio(f"/
|
62 |
except Exception as e:
|
63 |
return f"Error generating speech: {str(e)}"
|
64 |
|
|
|
53 |
full_audio = np.concatenate(audio_segments)
|
54 |
sample_rate = 24000 # Kokoro outputs at 24 kHz
|
55 |
# Ensure the static folder exists and save the file there
|
56 |
+
os.makedirs("tools", exist_ok=True)
|
57 |
+
filename = os.path.join("tools", "output.wav")
|
58 |
sf.write(filename, full_audio, sample_rate)
|
59 |
# Return an AgentAudio object pointing to the relative URL of the audio file
|
60 |
from smolagents.agent_types import AgentAudio
|
61 |
+
return AgentAudio(f"/tools/output.wav")
|
62 |
except Exception as e:
|
63 |
return f"Error generating speech: {str(e)}"
|
64 |
|