Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -270,15 +270,48 @@ interface_file = gr.Interface(
|
|
270 |
article=article,
|
271 |
)
|
272 |
|
273 |
-
def combined_output(
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
|
283 |
|
284 |
|
|
|
270 |
article=article,
|
271 |
)
|
272 |
|
273 |
+
def combined_output(
|
274 |
+
ytid_or_url,
|
275 |
+
start,
|
276 |
+
end,
|
277 |
+
speaker=speakers[0],
|
278 |
+
transpose: int = 0,
|
279 |
+
auto_predict_f0: bool = False,
|
280 |
+
cluster_infer_ratio: float = 0,
|
281 |
+
noise_scale: float = 0.4,
|
282 |
+
f0_method: str = "dio",
|
283 |
+
db_thresh: int = -40,
|
284 |
+
pad_seconds: float = 0.5,
|
285 |
+
chunk_seconds: float = 0.5,
|
286 |
+
absolute_thresh: bool = False,
|
287 |
+
):
|
288 |
+
# 调用原来的函数
|
289 |
+
full_song_output, cloned_vox_output = predict_song_from_yt(
|
290 |
+
ytid_or_url,
|
291 |
+
start,
|
292 |
+
end,
|
293 |
+
speaker,
|
294 |
+
transpose,
|
295 |
+
auto_predict_f0,
|
296 |
+
cluster_infer_ratio,
|
297 |
+
noise_scale,
|
298 |
+
f0_method,
|
299 |
+
db_thresh,
|
300 |
+
pad_seconds,
|
301 |
+
chunk_seconds,
|
302 |
+
absolute_thresh,
|
303 |
+
)
|
304 |
|
305 |
+
# 这里我们直接提取人声和伴奏,因为它们已经在predict_song_from_yt中被提取
|
306 |
+
original_track_filepath = download_youtube_clip(
|
307 |
+
ytid_or_url, start, end, "track.wav", force=True,
|
308 |
+
url_base="" if ytid_or_url.startswith("http") else "https://www.youtube.com/watch?v="
|
309 |
+
)
|
310 |
+
vox_wav, inst_wav = extract_vocal_demucs(demucs_model, original_track_filepath)
|
311 |
+
|
312 |
+
# 返回所有输出
|
313 |
+
return full_song_output, cloned_vox_output, (model.target_sample, vox_wav), (model.target_sample, inst_wav)
|
314 |
+
|
315 |
|
316 |
|
317 |
|