Shanulhaq commited on
Commit
3e117f4
1 Parent(s): 6976c11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -7,16 +7,14 @@ tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_
7
  def text_to_speech(text):
8
  # Generate speech from text
9
  audio_path = tts.tts_to_file(text=text, file_path="output.wav")
10
- # Read the audio file
11
- with open("output.wav", "rb") as f:
12
- audio_bytes = f.read()
13
- return audio_bytes
14
 
15
  # Create Gradio interface
16
  interface = gr.Interface(
17
  fn=text_to_speech,
18
  inputs=gr.Textbox(lines=5, placeholder="Enter text here..."),
19
- outputs=gr.Audio(type="file"),
20
  title="AI-Powered Text-to-Speech Converter",
21
  description="Convert text to speech using AI models.",
22
  )
 
7
  def text_to_speech(text):
8
  # Generate speech from text
9
  audio_path = tts.tts_to_file(text=text, file_path="output.wav")
10
+ # Return the path to the audio file
11
+ return audio_path
 
 
12
 
13
  # Create Gradio interface
14
  interface = gr.Interface(
15
  fn=text_to_speech,
16
  inputs=gr.Textbox(lines=5, placeholder="Enter text here..."),
17
+ outputs=gr.Audio(type="filepath"),
18
  title="AI-Powered Text-to-Speech Converter",
19
  description="Convert text to speech using AI models.",
20
  )