Neomindapp commited on
Commit
a9a3010
·
verified ·
1 Parent(s): 7a21455

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -1,5 +1,4 @@
1
  import gradio as gr
2
- import torch
3
  from TTS.api import TTS # Correct import path for TTS API
4
 
5
  # Define paths to the model and configuration
@@ -18,17 +17,13 @@ def generate_speech(text):
18
  with open(audio_path, "wb") as f:
19
  f.write(wav)
20
 
21
- # Read the audio file to return as binary data
22
- with open(audio_path, "rb") as f:
23
- audio_data = f.read()
24
-
25
- return audio_data
26
 
27
  # Define the Gradio interface
28
  iface = gr.Interface(
29
  fn=generate_speech,
30
  inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
31
- outputs=gr.Audio(type="file"),
32
  title="Text-to-Speech with Coqui TTS",
33
  description="Generate speech from text using a custom Coqui TTS model."
34
  )
 
1
  import gradio as gr
 
2
  from TTS.api import TTS # Correct import path for TTS API
3
 
4
  # Define paths to the model and configuration
 
17
  with open(audio_path, "wb") as f:
18
  f.write(wav)
19
 
20
+ return audio_path
 
 
 
 
21
 
22
  # Define the Gradio interface
23
  iface = gr.Interface(
24
  fn=generate_speech,
25
  inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
26
+ outputs=gr.Audio(type="filepath"),
27
  title="Text-to-Speech with Coqui TTS",
28
  description="Generate speech from text using a custom Coqui TTS model."
29
  )