AlexK-PL commited on
Commit
6a0c3cb
·
1 Parent(s): b48749f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -37,11 +37,12 @@ vocoder_model.load_state_dict(checkpoint['model_g'])
37
  vocoder_model.eval(inference=False)
38
 
39
 
40
- def synthesize(text):
41
  sequence = np.array(text_to_sequence(text, ['english_cleaners']))[None, :]
42
  sequence = torch.from_numpy(sequence).to(device='cpu', dtype=torch.int64)
43
 
44
- gst_head_scores = np.array([0.5, 0.15, 0.35]) # originally ([0.5, 0.15, 0.35])
 
45
  gst_scores = torch.from_numpy(gst_head_scores).float()
46
 
47
  mel_outputs, mel_outputs_postnet, _, alignments = model.inference(sequence, gst_scores)
@@ -54,6 +55,6 @@ def synthesize(text):
54
  return (22050, audio_numpy)
55
 
56
 
57
- iface = gr.Interface(fn=synthesize, inputs="text", outputs=[gr.Audio(label="Generated Speech", type="numpy"),])
58
  iface.launch()
59
 
 
37
  vocoder_model.eval(inference=False)
38
 
39
 
40
+ def synthesize(text, gst_1, gst_2, gst_3):
41
  sequence = np.array(text_to_sequence(text, ['english_cleaners']))[None, :]
42
  sequence = torch.from_numpy(sequence).to(device='cpu', dtype=torch.int64)
43
 
44
+ # gst_head_scores = np.array([0.5, 0.15, 0.35]) # originally ([0.5, 0.15, 0.35])
45
+ gst_head_scores = np.array([gst_1, gst_2, gst_3]) # originally ([0.5, 0.15, 0.35])
46
  gst_scores = torch.from_numpy(gst_head_scores).float()
47
 
48
  mel_outputs, mel_outputs_postnet, _, alignments = model.inference(sequence, gst_scores)
 
55
  return (22050, audio_numpy)
56
 
57
 
58
+ iface = gr.Interface(fn=synthesize, inputs=["text", gr.Slider(0.25, 0.55), gr.Slider(0.25, 0.55), gr.Slider(0.25, 0.55)], outputs=[gr.Audio(label="Generated Speech", type="numpy"),])
59
  iface.launch()
60