Pipe1213 commited on
Commit
d06d609
1 Parent(s): a3d1f8d

Update app.py

Browse files

speaker choise available

Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -38,10 +38,10 @@ _ = net_g.eval()
38
  _ = utils.load_checkpoint("fr_wa_finetuned_pho/G_125000.pth", net_g, None)
39
 
40
 
41
- def tts(text):
42
  if len(text) > 350:
43
  return "Error: Text is too long", None
44
- sid = torch.LongTensor([1]) # speaker identity
45
  stn_tst = get_text(text, hps)
46
 
47
  with torch.no_grad():
@@ -55,14 +55,15 @@ def tts(text):
55
  app = gr.Blocks()
56
  with app:
57
  with gr.Tabs():
58
- with gr.TabItem("Basic"):
59
- tts_input1 = gr.TextArea(label="Text in Walloon (350 words limitation)", value="")
60
- # tts_input2 = gr.Dropdown(label="Speaker", choices=hps.speakers, type="index", value=hps.speakers[0])
61
  tts_submit = gr.Button("Generate", variant="primary")
62
  tts_output1 = gr.Textbox(label="Message")
63
  tts_output2 = gr.Audio(label="Output")
64
- tts_submit.click(tts, [tts_input1], [tts_output1, tts_output2])
65
 
66
  app.launch()
67
 
 
68
 
 
38
  _ = utils.load_checkpoint("fr_wa_finetuned_pho/G_125000.pth", net_g, None)
39
 
40
 
41
+ def tts(text, speaker_id):
42
  if len(text) > 350:
43
  return "Error: Text is too long", None
44
+ sid = torch.LongTensor([speaker_id]) # speaker identity
45
  stn_tst = get_text(text, hps)
46
 
47
  with torch.no_grad():
 
55
  app = gr.Blocks()
56
  with app:
57
  with gr.Tabs():
58
+ with gr.TabItem("Phonemes_finetuned"):
59
+ tts_input1 = gr.TextArea(label="Text in Walloon in phonemes IPA (350 words limitation)", value="")
60
+ tts_input2 = gr.Dropdown(label="Speaker", choices=["Male", "Female"], type="index", value="Male")
61
  tts_submit = gr.Button("Generate", variant="primary")
62
  tts_output1 = gr.Textbox(label="Message")
63
  tts_output2 = gr.Audio(label="Output")
64
+ tts_submit.click(tts, [tts_input1, tts_input2], [tts_output1, tts_output2])
65
 
66
  app.launch()
67
 
68
+
69