Spaces:
Running
Running
Katock
commited on
Commit
·
054c3da
1
Parent(s):
5efa479
debug
Browse files- app.py +1 -1
- inference/slicer.py +3 -4
app.py
CHANGED
@@ -90,7 +90,7 @@ if __name__ == '__main__':
|
|
90 |
with gr.TabItem(name):
|
91 |
with gr.Row():
|
92 |
with gr.Column():
|
93 |
-
vc_input = gr.Audio(label="上传干声
|
94 |
vc_transform = gr.Number(label="音高调整 (支持正负半音,12为一个八度)", value=0)
|
95 |
auto_f0 = gr.Checkbox(label="自动音高预测 (正常说话可选)", value=False)
|
96 |
f0_predictor = gr.Radio(label="f0预测器 (对电音有影响)",
|
|
|
90 |
with gr.TabItem(name):
|
91 |
with gr.Row():
|
92 |
with gr.Column():
|
93 |
+
vc_input = gr.Audio(label="上传干声 (已支持长音频)" if limitation else '')
|
94 |
vc_transform = gr.Number(label="音高调整 (支持正负半音,12为一个八度)", value=0)
|
95 |
auto_f0 = gr.Checkbox(label="自动音高预测 (正常说话可选)", value=False)
|
96 |
f0_predictor = gr.Radio(label="f0预测器 (对电音有影响)",
|
inference/slicer.py
CHANGED
@@ -118,8 +118,7 @@ class Slicer:
|
|
118 |
|
119 |
|
120 |
def cut(input_audio, db_thresh=-30, min_len=5000):
|
121 |
-
|
122 |
-
sr, audio = input_audio
|
123 |
slicer = Slicer(
|
124 |
sr=sr,
|
125 |
threshold=db_thresh,
|
@@ -129,9 +128,9 @@ def cut(input_audio, db_thresh=-30, min_len=5000):
|
|
129 |
return chunks
|
130 |
|
131 |
|
132 |
-
def chunks2audio(
|
133 |
chunks = dict(chunks)
|
134 |
-
|
135 |
if len(audio.shape) == 2 and audio.shape[1] >= 2:
|
136 |
audio = torch.mean(audio, dim=0).unsqueeze(0)
|
137 |
audio = audio.cpu().numpy()[0]
|
|
|
118 |
|
119 |
|
120 |
def cut(input_audio, db_thresh=-30, min_len=5000):
|
121 |
+
audio, sr = librosa.load(input_audio, sr=None)
|
|
|
122 |
slicer = Slicer(
|
123 |
sr=sr,
|
124 |
threshold=db_thresh,
|
|
|
128 |
return chunks
|
129 |
|
130 |
|
131 |
+
def chunks2audio(audio_path, chunks):
|
132 |
chunks = dict(chunks)
|
133 |
+
audio, sr = torchaudio.load(audio_path)
|
134 |
if len(audio.shape) == 2 and audio.shape[1] >= 2:
|
135 |
audio = torch.mean(audio, dim=0).unsqueeze(0)
|
136 |
audio = audio.cpu().numpy()[0]
|