Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,10 +10,8 @@ from melgan.utils.hparams import load_hparam
|
|
| 10 |
|
| 11 |
import torch
|
| 12 |
import numpy as np
|
| 13 |
-
import random
|
| 14 |
|
| 15 |
from matplotlib import pyplot as plt
|
| 16 |
-
from matplotlib import gridspec
|
| 17 |
|
| 18 |
# Adjust vertical spacing between subplots
|
| 19 |
plt.subplots_adjust(hspace=0.15) # You can adjust the value as needed
|
|
@@ -87,21 +85,11 @@ def synthesize(text, gst_1, gst_2, gst_3):
|
|
| 87 |
fig_mel = plot_spec_align(mel_outputs_postnet, alignments)
|
| 88 |
|
| 89 |
return (22050, audio_numpy), fig_mel # fig_align
|
|
|
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
rand_weight_2 = random.randrange(0.3, 0.45, 0.01)
|
| 95 |
-
rand_weight_3 = 1.0 - (rand_weight_1 + rand_weight_2)
|
| 96 |
-
|
| 97 |
-
return rand_weight_1, rand_weight_2, rand_weight_3
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
w1, w2, w3 = randomize_style_weights()
|
| 101 |
-
|
| 102 |
-
iface = gr.Interface(fn=synthesize, inputs=[gr.Textbox(label="Input Text"), gr.Slider(0.2, 0.45, label="First style token weight:", value=w1),
|
| 103 |
-
gr.Slider(0.2, 0.45, label="Second style token weight:", value=w2),
|
| 104 |
-
gr.Slider(0.2, 0.45, label="Third style token weight:",value=w3)],
|
| 105 |
outputs=[gr.Audio(label="Generated Speech", type="numpy"), gr.Plot(label="Output"),],
|
| 106 |
title="Single-Head Attention Tacotron2 with Style Tokens", description=DESCRIPTION)
|
| 107 |
iface.launch()
|
|
|
|
| 10 |
|
| 11 |
import torch
|
| 12 |
import numpy as np
|
|
|
|
| 13 |
|
| 14 |
from matplotlib import pyplot as plt
|
|
|
|
| 15 |
|
| 16 |
# Adjust vertical spacing between subplots
|
| 17 |
plt.subplots_adjust(hspace=0.15) # You can adjust the value as needed
|
|
|
|
| 85 |
fig_mel = plot_spec_align(mel_outputs_postnet, alignments)
|
| 86 |
|
| 87 |
return (22050, audio_numpy), fig_mel # fig_align
|
| 88 |
+
|
| 89 |
|
| 90 |
+
iface = gr.Interface(fn=synthesize, inputs=[gr.Textbox(label="Input Text"), gr.Slider(0.2, 0.45, label="First style token weight:", value=0.4),
|
| 91 |
+
gr.Slider(0.2, 0.45, label="Second style token weight:", value=0.26),
|
| 92 |
+
gr.Slider(0.2, 0.45, label="Third style token weight:", value=0.33)],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
outputs=[gr.Audio(label="Generated Speech", type="numpy"), gr.Plot(label="Output"),],
|
| 94 |
title="Single-Head Attention Tacotron2 with Style Tokens", description=DESCRIPTION)
|
| 95 |
iface.launch()
|