Pendrokar commited on
Commit
e0319b0
β€’
1 Parent(s): b118ac7

voice model sample fix

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. gr_client.py +18 -4
app.py CHANGED
@@ -160,5 +160,5 @@ class LocalBlocksDemo(BlocksDemo):
160
 
161
  if __name__ == "__main__":
162
  print('running custom Gradio interface')
163
- demo = LocalBlocksDemo()
164
  demo.block.launch()
 
160
 
161
  if __name__ == "__main__":
162
  print('running custom Gradio interface')
163
+ demo = LocalBlocksDemo(models_path)
164
  demo.block.launch()
gr_client.py CHANGED
@@ -296,7 +296,11 @@ _DESCRIPTION = '''
296
 
297
 
298
  class BlocksDemo:
299
- def __init__(self):
 
 
 
 
300
  with gr.Blocks(css=".arpabet {background-color: gray; border-radius: 5px; font-size: 120%; padding: 0 0.1em; margin: 0 0.1em; text-align: center}") as demo:
301
  gr.Markdown("# xVASynth TTS")
302
 
@@ -471,7 +475,13 @@ class BlocksDemo:
471
  queue=False,
472
  )
473
 
474
- self.block = demo
 
 
 
 
 
 
475
 
476
  def predict(
477
  self,
@@ -535,12 +545,16 @@ class BlocksDemo:
535
  round(json_data['em_angry'][0], 2),
536
  round(json_data['em_happy'][0], 2),
537
  round(json_data['em_sad'][0], 2),
538
- round(json_data['em_surprise'][0], 2)
 
539
  ]
540
 
 
 
 
541
  if __name__ == "__main__":
542
  print('running Gradio interface')
543
  client = Client("Pendrokar/xVASynth")
544
 
545
- demo = BlocksDemo()
546
  demo.block.launch()
 
296
 
297
 
298
  class BlocksDemo:
299
+ def __init__(self, models_path):
300
+ self.models_path = models_path
301
+ self.block = self.create_interface()
302
+
303
+ def create_interface(self):
304
  with gr.Blocks(css=".arpabet {background-color: gray; border-radius: 5px; font-size: 120%; padding: 0 0.1em; margin: 0 0.1em; text-align: center}") as demo:
305
  gr.Markdown("# xVASynth TTS")
306
 
 
475
  queue=False,
476
  )
477
 
478
+ voice_radio.change(
479
+ self.set_default_audio,
480
+ inputs=voice_radio,
481
+ outputs=output_wav
482
+ )
483
+
484
+ return demo
485
 
486
  def predict(
487
  self,
 
545
  round(json_data['em_angry'][0], 2),
546
  round(json_data['em_happy'][0], 2),
547
  round(json_data['em_sad'][0], 2),
548
+ round(json_data['em_surprise'][0], 2),
549
+ response
550
  ]
551
 
552
+ def set_default_audio(self, voice_id):
553
+ return self.models_path + voice_id + '.wav'
554
+
555
  if __name__ == "__main__":
556
  print('running Gradio interface')
557
  client = Client("Pendrokar/xVASynth")
558
 
559
+ demo = BlocksDemo('')
560
  demo.block.launch()