saeedabdulmuizz commited on
Commit
68eb694
·
verified ·
1 Parent(s): effa60e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -222,14 +222,15 @@ with gr.Blocks(title="GAASH-Lab: Kashmiri TTS & Translation") as demo:
222
  with gr.Column():
223
  input_text = gr.Textbox(label="Input Text", placeholder="Type here...")
224
  is_english = gr.Checkbox(label="Input is English (Translate first)", value=False)
225
- speaker_slider = gr.Slider(0, model.n_spks - 1, step=1, value=0, label="Speaker ID")
226
  gen_btn = gr.Button("Generate Speech", variant="primary")
227
 
228
  with gr.Column():
229
  trans_view = gr.Textbox(label="Processed/Translated Kashmiri Text", interactive=False)
230
  audio_output = gr.Audio(label="Audio", type="filepath")
231
 
232
- def pipeline(text, is_eng, spk_id):
 
233
  processed_text = text
234
  if is_eng:
235
  print(f"Translating input: {text}")
@@ -241,7 +242,7 @@ with gr.Blocks(title="GAASH-Lab: Kashmiri TTS & Translation") as demo:
241
 
242
  gen_btn.click(
243
  pipeline,
244
- inputs=[input_text, is_english, speaker_slider],
245
  outputs=[trans_view, audio_output]
246
  )
247
 
 
222
  with gr.Column():
223
  input_text = gr.Textbox(label="Input Text", placeholder="Type here...")
224
  is_english = gr.Checkbox(label="Input is English (Translate first)", value=False)
225
+ speaker_radio = gr.Radio(choices=["Male", "Female"], value="Male", label="Speaker Voice")
226
  gen_btn = gr.Button("Generate Speech", variant="primary")
227
 
228
  with gr.Column():
229
  trans_view = gr.Textbox(label="Processed/Translated Kashmiri Text", interactive=False)
230
  audio_output = gr.Audio(label="Audio", type="filepath")
231
 
232
+ def pipeline(text, is_eng, spk_voice):
233
+ spk_id = 422 if spk_voice == "Male" else 423
234
  processed_text = text
235
  if is_eng:
236
  print(f"Translating input: {text}")
 
242
 
243
  gen_btn.click(
244
  pipeline,
245
+ inputs=[input_text, is_english, speaker_radio],
246
  outputs=[trans_view, audio_output]
247
  )
248