Spaces:
Build error
Build error
added mic input
Browse files
app.py
CHANGED
@@ -28,10 +28,19 @@ _ = net_g.eval()
|
|
28 |
_ = utils.load_checkpoint("logs/ow2/G_195000.pth", net_g, None)
|
29 |
|
30 |
|
31 |
-
def infer(md, audio, speaker_id, pitch_shift, length_scale, noise_scale=.667, noise_scale_w=0.8):
|
32 |
-
fname = audio
|
33 |
-
source, sr = torchaudio.load(fname)
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
source = torchaudio.functional.pitch_shift(source, sr, int(pitch_shift))#, n_fft=256)
|
36 |
source = torchaudio.functional.resample(source, sr, 16000)
|
37 |
source = torch.mean(source, dim=0).unsqueeze(0)
|
@@ -63,6 +72,7 @@ demo = gradio.Interface(
|
|
63 |
|
64 |
( * up to Kiriko and without Bastion. Please forgive. )
|
65 |
"""),
|
|
|
66 |
gradio.Audio(label="Input Audio", type="filepath"),
|
67 |
gradio.Dropdown(label="Target Voice", choices=["Ana", "Ashe", "Baptiste", "Brigitte", "Cassidy", "Doomfist", "D.Va", "Echo", "Genji", "Hanzo", "Junker Queen", "Junkrat", "Kiriko", "Lúcio", "Mei", "Mercy", "Moira", "Orisa", "Pharah", "Reaper", "Reinhardt", "Roadhog", "Sigma", "Sojourn", "Soldier_ 76", "Sombra", "Symmetra", "Torbjörn", "Tracer", "Widowmaker", "Winston", "Zarya", "Zenyatta"], type="index", value="Ana"),
|
68 |
gradio.Slider(label="Pitch Shift Input (+12 = up one octave, ⚠️ broken AF ⚠️)", minimum=-12.0, maximum=12.0, value=0, step=1),
|
|
|
28 |
_ = utils.load_checkpoint("logs/ow2/G_195000.pth", net_g, None)
|
29 |
|
30 |
|
31 |
+
def infer(md, mic_audio, audio, speaker_id, pitch_shift, length_scale, noise_scale=.667, noise_scale_w=0.8):
|
|
|
|
|
32 |
|
33 |
+
source = None
|
34 |
+
sr = None
|
35 |
+
|
36 |
+
if mic_audio:
|
37 |
+
sr, source = mic_audio
|
38 |
+
source = torch.Tensor(source)
|
39 |
+
source = source.T
|
40 |
+
|
41 |
+
if audio:
|
42 |
+
source, sr = torchaudio.load(audio)
|
43 |
+
|
44 |
source = torchaudio.functional.pitch_shift(source, sr, int(pitch_shift))#, n_fft=256)
|
45 |
source = torchaudio.functional.resample(source, sr, 16000)
|
46 |
source = torch.mean(source, dim=0).unsqueeze(0)
|
|
|
72 |
|
73 |
( * up to Kiriko and without Bastion. Please forgive. )
|
74 |
"""),
|
75 |
+
gradio.Audio(source="microphone", label="Record your own voice"),
|
76 |
gradio.Audio(label="Input Audio", type="filepath"),
|
77 |
gradio.Dropdown(label="Target Voice", choices=["Ana", "Ashe", "Baptiste", "Brigitte", "Cassidy", "Doomfist", "D.Va", "Echo", "Genji", "Hanzo", "Junker Queen", "Junkrat", "Kiriko", "Lúcio", "Mei", "Mercy", "Moira", "Orisa", "Pharah", "Reaper", "Reinhardt", "Roadhog", "Sigma", "Sojourn", "Soldier_ 76", "Sombra", "Symmetra", "Torbjörn", "Tracer", "Widowmaker", "Winston", "Zarya", "Zenyatta"], type="index", value="Ana"),
|
78 |
gradio.Slider(label="Pitch Shift Input (+12 = up one octave, ⚠️ broken AF ⚠️)", minimum=-12.0, maximum=12.0, value=0, step=1),
|