Spaces:
Sleeping
Sleeping
Commit
·
6dc0682
1
Parent(s):
3daca4d
Update app.py
Browse files
app.py
CHANGED
@@ -59,7 +59,19 @@ _ = utils.load_checkpoint("checkpoints/freevc-cvfr.pth", freevc_cvfr, None)
|
|
59 |
print("Loading WavLM for content...")
|
60 |
cmodel = WavLMModel.from_pretrained("microsoft/wavlm-large").to(device)
|
61 |
|
62 |
-
def convert(model,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
with torch.no_grad():
|
64 |
# tgt
|
65 |
wav_tgt, _ = librosa.load(tgt, sr=hps.data.sampling_rate)
|
@@ -101,10 +113,10 @@ def convert(model, src, tgt):
|
|
101 |
return out
|
102 |
|
103 |
model = gr.Dropdown(choices=["FreeVC", "FreeVC-s", "FreeVC (24kHz)","FreeVC CVFR"], value="FreeVC",type="value", label="Model")
|
104 |
-
|
105 |
-
|
106 |
audio2 = gr.inputs.Audio(label="Reference Audio", type='filepath')
|
107 |
-
inputs = [model,
|
108 |
outputs = gr.outputs.Audio(label="Output Audio", type='filepath')
|
109 |
|
110 |
title = "FreeVC"
|
|
|
59 |
print("Loading WavLM for content...")
|
60 |
cmodel = WavLMModel.from_pretrained("microsoft/wavlm-large").to(device)
|
61 |
|
62 |
+
def convert(model, src_mic,src_file, tgt):
|
63 |
+
"""
|
64 |
+
helper function which checks where source come from
|
65 |
+
"""
|
66 |
+
src = None
|
67 |
+
if src_mic:
|
68 |
+
src_= src_mic
|
69 |
+
elif src_file:
|
70 |
+
src = src_file
|
71 |
+
if not src:
|
72 |
+
logging.warning("source or target are not provided")
|
73 |
+
return
|
74 |
+
|
75 |
with torch.no_grad():
|
76 |
# tgt
|
77 |
wav_tgt, _ = librosa.load(tgt, sr=hps.data.sampling_rate)
|
|
|
113 |
return out
|
114 |
|
115 |
model = gr.Dropdown(choices=["FreeVC", "FreeVC-s", "FreeVC (24kHz)","FreeVC CVFR"], value="FreeVC",type="value", label="Model")
|
116 |
+
audio1_mic=gr.Audio(source="microphone", type="filepath", label='record your voice', optional=True)
|
117 |
+
audio1_file = gr.inputs.Audio(label="Source Audio", type='filepath', label='or upload an audio file', optional=True)
|
118 |
audio2 = gr.inputs.Audio(label="Reference Audio", type='filepath')
|
119 |
+
inputs = [model, audio1_mic, audio1_file, audio2]
|
120 |
outputs = gr.outputs.Audio(label="Output Audio", type='filepath')
|
121 |
|
122 |
title = "FreeVC"
|