Pipe1213 commited on
Commit
a3d1f8d
1 Parent(s): 5cf39a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -39,16 +39,16 @@ _ = utils.load_checkpoint("fr_wa_finetuned_pho/G_125000.pth", net_g, None)
39
 
40
 
41
  def tts(text):
42
- if len(text) > 150:
43
  return "Error: Text is too long", None
44
  sid = torch.LongTensor([1]) # speaker identity
45
- stn_tst = get_text(text, hps_ms)
46
 
47
  with torch.no_grad():
48
  x_tst = stn_tst.unsqueeze(0)
49
  x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
50
  # print(stn_tst.size())
51
- audio = net_g_ms.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8, length_scale=1)[0][
52
  0, 0].data.float().numpy()
53
  return "Success", (hps.data.sampling_rate, audio)
54
 
@@ -56,7 +56,7 @@ app = gr.Blocks()
56
  with app:
57
  with gr.Tabs():
58
  with gr.TabItem("Basic"):
59
- tts_input1 = gr.TextArea(label="Text in Japanese (150 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")
 
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():
48
  x_tst = stn_tst.unsqueeze(0)
49
  x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
50
  # print(stn_tst.size())
51
+ audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8, length_scale=1)[0][
52
  0, 0].data.float().numpy()
53
  return "Success", (hps.data.sampling_rate, audio)
54
 
 
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")