Tonic commited on
Commit
0416a60
1 Parent(s): 65a292c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -18,12 +18,9 @@ Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder
18
  """
19
 
20
  @spaces.GPU
21
- def whisper_speech_demo(text, lang, speaker_audio=None, mix_lang=None, mix_text=None):
22
  pipe = Pipeline()
23
- speaker_url = None
24
-
25
- if speaker_audio is not None:
26
- speaker_url = speaker_audio.name
27
 
28
  if mix_lang and mix_text:
29
  mixed_langs = lang.split(',') + mix_lang.split(',')
@@ -60,12 +57,12 @@ with gr.Blocks() as demo:
60
  generate_button_standard = gr.Button("Generate Speech")
61
  output_audio_standard = gr.Audio(label="🌬️💬📝WhisperSpeech")
62
 
63
- generate_button_standard.click(
64
- whisper_speech_demo,
65
- inputs=[text_input_standard, lang_input_standard, speaker_input_standard, None, None],
66
- outputs=output_audio_standard
67
- )
68
-
69
  with gr.TabItem("🌬️💬📝Mixed Language TTS"):
70
  with gr.Row():
71
  mix_text_input_mixed = gr.Textbox(label="Enter mixed language text", placeholder="e.g., Hello, Cześć")
@@ -75,8 +72,10 @@ with gr.Blocks() as demo:
75
 
76
  generate_button_mixed.click(
77
  whisper_speech_demo,
78
- inputs=[None, None, None, mix_lang_input_mixed, mix_text_input_mixed],
79
  outputs=output_audio_mixed
80
  )
81
 
 
 
82
  demo.launch()
 
18
  """
19
 
20
  @spaces.GPU
21
+ def whisper_speech_demo(text, lang, speaker_audio, mix_lang, mix_text):
22
  pipe = Pipeline()
23
+ speaker_url = speaker_audio if speaker_audio else None
 
 
 
24
 
25
  if mix_lang and mix_text:
26
  mixed_langs = lang.split(',') + mix_lang.split(',')
 
57
  generate_button_standard = gr.Button("Generate Speech")
58
  output_audio_standard = gr.Audio(label="🌬️💬📝WhisperSpeech")
59
 
60
+ generate_button_standard.click(
61
+ whisper_speech_demo,
62
+ inputs=[text_input_standard, lang_input_standard, speaker_input_standard, "", ""],
63
+ outputs=output_audio_standard
64
+ )
65
+
66
  with gr.TabItem("🌬️💬📝Mixed Language TTS"):
67
  with gr.Row():
68
  mix_text_input_mixed = gr.Textbox(label="Enter mixed language text", placeholder="e.g., Hello, Cześć")
 
72
 
73
  generate_button_mixed.click(
74
  whisper_speech_demo,
75
+ inputs=["", "", "", mix_lang_input_mixed, mix_text_input_mixed],
76
  outputs=output_audio_mixed
77
  )
78
 
79
+
80
+
81
  demo.launch()