uasername commited on
Commit
7036d0d
·
verified ·
1 Parent(s): 0759335

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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("static", exist_ok=True)
57
- filename = os.path.join("static", "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"/static/output.wav")
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