Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,8 @@ from models import SynthesizerTrn
|
|
9 |
from text.symbols import symbols
|
10 |
from text import text_to_sequence
|
11 |
|
|
|
|
|
12 |
import json
|
13 |
import math
|
14 |
|
@@ -36,8 +38,8 @@ def vc_fn(input):
|
|
36 |
x_tst = stn_tst.unsqueeze(0)
|
37 |
x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
|
38 |
audio = net_g.infer(x_tst, x_tst_lengths, noise_scale=.667, noise_scale_w=0.8, length_scale=1)[0][0,0].data.cpu().float().numpy()
|
39 |
-
sampling_rate = 22050
|
40 |
-
return
|
41 |
|
42 |
app = gr.Blocks()
|
43 |
with app:
|
@@ -45,7 +47,8 @@ with app:
|
|
45 |
with gr.TabItem("Basic"):
|
46 |
vc_input = gr.Textbox(label="Input Message")
|
47 |
vc_submit = gr.Button("Convert", variant="primary")
|
48 |
-
vc_output = gr.Audio(label="Output Audio")
|
|
|
49 |
vc_submit.click(vc_fn, [ vc_input], [vc_output])
|
50 |
|
51 |
app.launch()
|
|
|
9 |
from text.symbols import symbols
|
10 |
from text import text_to_sequence
|
11 |
|
12 |
+
import IPython.display as ipd
|
13 |
+
|
14 |
import json
|
15 |
import math
|
16 |
|
|
|
38 |
x_tst = stn_tst.unsqueeze(0)
|
39 |
x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
|
40 |
audio = net_g.infer(x_tst, x_tst_lengths, noise_scale=.667, noise_scale_w=0.8, length_scale=1)[0][0,0].data.cpu().float().numpy()
|
41 |
+
#sampling_rate = 22050
|
42 |
+
return audio
|
43 |
|
44 |
app = gr.Blocks()
|
45 |
with app:
|
|
|
47 |
with gr.TabItem("Basic"):
|
48 |
vc_input = gr.Textbox(label="Input Message")
|
49 |
vc_submit = gr.Button("Convert", variant="primary")
|
50 |
+
#vc_output = gr.Audio(label="Output Audio")
|
51 |
+
vc_output = ipd.display(ipd.Audio(audio, rate=hps.data.sampling_rate))
|
52 |
vc_submit.click(vc_fn, [ vc_input], [vc_output])
|
53 |
|
54 |
app.launch()
|