Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,7 +52,7 @@ hubert = torch.hub.load("bshall/hubert:main", "hubert_soft")
|
|
| 52 |
|
| 53 |
_ = utils.load_checkpoint("G_18000.pth", net_g_ms, None)
|
| 54 |
|
| 55 |
-
def vc_fn(input_audio,vc_transform,
|
| 56 |
if input_audio is None:
|
| 57 |
return "You need to upload an audio", None
|
| 58 |
sampling_rate, audio = input_audio
|
|
@@ -77,7 +77,7 @@ def vc_fn(input_audio,vc_transform,vc_input4):
|
|
| 77 |
print(sampling_rate)
|
| 78 |
f0 = resize2d(f0, len(soft[:, 0])) * vc_transform
|
| 79 |
soft[:, 0] = f0 / 10
|
| 80 |
-
sid = torch.LongTensor([
|
| 81 |
stn_tst = torch.FloatTensor(soft)
|
| 82 |
with torch.no_grad():
|
| 83 |
x_tst = stn_tst.unsqueeze(0)
|
|
@@ -95,10 +95,10 @@ with app:
|
|
| 95 |
with gr.TabItem("Basic"):
|
| 96 |
vc_input3 = gr.Audio(label="Input Audio (30s limitation)")
|
| 97 |
vc_transform = gr.Number(label="transform",value=1.0)
|
| 98 |
-
|
| 99 |
vc_submit = gr.Button("Convert", variant="primary")
|
| 100 |
vc_output1 = gr.Textbox(label="Output Message")
|
| 101 |
vc_output2 = gr.Audio(label="Output Audio")
|
| 102 |
-
vc_submit.click(vc_fn, [vc_input3, vc_transform,
|
| 103 |
|
| 104 |
app.launch()
|
|
|
|
| 52 |
|
| 53 |
_ = utils.load_checkpoint("G_18000.pth", net_g_ms, None)
|
| 54 |
|
| 55 |
+
def vc_fn(input_audio,vc_transform,vcid):
|
| 56 |
if input_audio is None:
|
| 57 |
return "You need to upload an audio", None
|
| 58 |
sampling_rate, audio = input_audio
|
|
|
|
| 77 |
print(sampling_rate)
|
| 78 |
f0 = resize2d(f0, len(soft[:, 0])) * vc_transform
|
| 79 |
soft[:, 0] = f0 / 10
|
| 80 |
+
sid = torch.LongTensor([vcid])
|
| 81 |
stn_tst = torch.FloatTensor(soft)
|
| 82 |
with torch.no_grad():
|
| 83 |
x_tst = stn_tst.unsqueeze(0)
|
|
|
|
| 95 |
with gr.TabItem("Basic"):
|
| 96 |
vc_input3 = gr.Audio(label="Input Audio (30s limitation)")
|
| 97 |
vc_transform = gr.Number(label="transform",value=1.0)
|
| 98 |
+
vcid=gr.Textbox(label="speakerID",value=0),
|
| 99 |
vc_submit = gr.Button("Convert", variant="primary")
|
| 100 |
vc_output1 = gr.Textbox(label="Output Message")
|
| 101 |
vc_output2 = gr.Audio(label="Output Audio")
|
| 102 |
+
vc_submit.click(vc_fn, inputs=vcid, [vc_input3, vc_transform,], [vc_output1, vc_output2])
|
| 103 |
|
| 104 |
app.launch()
|