tykiww commited on
Commit
c5ee403
·
verified ·
1 Parent(s): d68d9c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -29
app.py CHANGED
@@ -27,7 +27,7 @@ def init_TTS(config):
27
 
28
 
29
  @spaces.GPU
30
- def generate_speech(text):
31
  # Generate speech using the provided text, speaker voice, and language
32
  tts.tts_to_file(text=text,
33
  file_path=config['inference']['file_path'],
@@ -40,36 +40,19 @@ def generate_speech(text):
40
  def main(config):
41
 
42
  # Create the Gradio interface
43
- #demo = gr.Interface(
44
- # fn=generate_speech,
45
- # inputs=[
46
- # gr.Textbox(label="Enter your text")
47
- # ],
48
- # outputs="audio",
49
- # title="Voice Synthesis with Coqui-XTTS",
50
- # description="Synthesize speech using predefined target voice and language."
51
- #)
 
52
 
53
  # Launch the interface
54
- #demo.launch()
55
- #return 0
56
-
57
- with gr.Blocks() as demo:
58
- gr.Markdown("# Voice Synthesis with Coqui-XTTS")
59
- gr.Markdown("Synthesize speech using predefined target voice and language")
60
-
61
- textbox = gr.Textbox(label="Enter your text")
62
- tune_btn = gr.Button("Synthesize Text")
63
- outputs = gr.outputs.Audio(type="auto", label=None)
64
-
65
- tune_btn.click(fn=generate_speech,
66
- inputs=[
67
- textbox
68
- ],
69
- outputs="audio")
70
-
71
- demo.launch()
72
-
73
  return 0
74
 
75
 
 
27
 
28
 
29
  @spaces.GPU
30
+ def generate_speech(microphone, text):
31
  # Generate speech using the provided text, speaker voice, and language
32
  tts.tts_to_file(text=text,
33
  file_path=config['inference']['file_path'],
 
40
  def main(config):
41
 
42
  # Create the Gradio interface
43
+ demo = gr.Interface(
44
+ fn=generate_speech,
45
+ inputs=[
46
+ audio_box = gr.Audio(label="Audio", sources="microphone", type="filepath", elem_id='audio'),
47
+ gr.Textbox(label="Enter your text")
48
+ ],
49
+ outputs="audio",
50
+ title="Voice Synthesis with Coqui-XTTS",
51
+ description="Synthesize speech using predefined target voice and language."
52
+ )
53
 
54
  # Launch the interface
55
+ demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  return 0
57
 
58