Spaces:
Running
Running
Eddycrack864
commited on
Commit
β’
caada4c
1
Parent(s):
ec1c2c4
Upload app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import torch
|
3 |
import logging
|
4 |
import yt_dlp
|
|
|
5 |
import gradio as gr
|
6 |
import assets.themes.loadThemes as loadThemes
|
7 |
from gradio_i18n import Translate
|
@@ -178,6 +179,7 @@ def download_audio(url, output_dir="ytdl"):
|
|
178 |
except Exception as e:
|
179 |
raise Exception(f"Error extracting audio with yt-dlp: {str(e)}")
|
180 |
|
|
|
181 |
def roformer_separator(audio, model_key, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
182 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
183 |
roformer_model = roformer_models[model_key]
|
@@ -208,7 +210,8 @@ def roformer_separator(audio, model_key, out_format, segment_size, override_seg_
|
|
208 |
return stems[1], stems[0]
|
209 |
except Exception as e:
|
210 |
raise RuntimeError(f"Roformer separation failed: {e}") from e
|
211 |
-
|
|
|
212 |
def mdxc_separator(audio, model, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
213 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
214 |
try:
|
@@ -239,6 +242,7 @@ def mdxc_separator(audio, model, out_format, segment_size, override_seg_size, ov
|
|
239 |
except Exception as e:
|
240 |
raise RuntimeError(f"MDX23C separation failed: {e}") from e
|
241 |
|
|
|
242 |
def mdxnet_separator(audio, model, out_format, hop_length, segment_size, denoise, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
243 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
244 |
try:
|
@@ -270,6 +274,7 @@ def mdxnet_separator(audio, model, out_format, hop_length, segment_size, denoise
|
|
270 |
except Exception as e:
|
271 |
raise RuntimeError(f"MDX-NET separation failed: {e}") from e
|
272 |
|
|
|
273 |
def vrarch_separator(audio, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
274 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
275 |
try:
|
@@ -303,6 +308,7 @@ def vrarch_separator(audio, model, out_format, window_size, aggression, tta, pos
|
|
303 |
except Exception as e:
|
304 |
raise RuntimeError(f"VR ARCH separation failed: {e}") from e
|
305 |
|
|
|
306 |
def demucs_separator(audio, model, out_format, shifts, segment_size, segments_enabled, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
307 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
308 |
try:
|
@@ -344,6 +350,7 @@ def update_stems(model):
|
|
344 |
else:
|
345 |
return gr.update(visible=False)
|
346 |
|
|
|
347 |
def roformer_batch(path_input, path_output, model_key, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh):
|
348 |
found_files.clear()
|
349 |
logs.clear()
|
@@ -393,6 +400,7 @@ def roformer_batch(path_input, path_output, model_key, out_format, segment_size,
|
|
393 |
except Exception as e:
|
394 |
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
395 |
|
|
|
396 |
def mdx23c_batch(path_input, path_output, model, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh):
|
397 |
found_files.clear()
|
398 |
logs.clear()
|
@@ -441,6 +449,7 @@ def mdx23c_batch(path_input, path_output, model, out_format, segment_size, overr
|
|
441 |
except Exception as e:
|
442 |
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
443 |
|
|
|
444 |
def mdxnet_batch(path_input, path_output, model, out_format, hop_length, segment_size, denoise, overlap, batch_size, norm_thresh, amp_thresh):
|
445 |
found_files.clear()
|
446 |
logs.clear()
|
@@ -490,6 +499,7 @@ def mdxnet_batch(path_input, path_output, model, out_format, hop_length, segment
|
|
490 |
except Exception as e:
|
491 |
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
492 |
|
|
|
493 |
def vrarch_batch(path_input, path_output, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh):
|
494 |
found_files.clear()
|
495 |
logs.clear()
|
@@ -541,6 +551,7 @@ def vrarch_batch(path_input, path_output, model, out_format, window_size, aggres
|
|
541 |
except Exception as e:
|
542 |
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
543 |
|
|
|
544 |
def demucs_batch(path_input, path_output, model, out_format, shifts, segment_size, segments_enabled, overlap, batch_size, norm_thresh, amp_thresh):
|
545 |
found_files.clear()
|
546 |
logs.clear()
|
@@ -592,8 +603,8 @@ def demucs_batch(path_input, path_output, model, out_format, shifts, segment_siz
|
|
592 |
with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "π΅ UVR5 UI π΅") as app:
|
593 |
with Translate("assets/languages/translation.yaml", placeholder_langs = ["en", "es", "it", "pt", "ms", "id", "ru", "uk", "th", "zh", "ja", "ko", "tr", "hi"]) as lang:
|
594 |
gr.Markdown("<h1> π΅ UVR5 UI π΅ </h1>")
|
595 |
-
gr.Markdown(
|
596 |
-
gr.Markdown(
|
597 |
with gr.Tabs():
|
598 |
with gr.TabItem("BS/Mel Roformer"):
|
599 |
with gr.Row():
|
|
|
2 |
import torch
|
3 |
import logging
|
4 |
import yt_dlp
|
5 |
+
import spaces
|
6 |
import gradio as gr
|
7 |
import assets.themes.loadThemes as loadThemes
|
8 |
from gradio_i18n import Translate
|
|
|
179 |
except Exception as e:
|
180 |
raise Exception(f"Error extracting audio with yt-dlp: {str(e)}")
|
181 |
|
182 |
+
@spaces.GPU(duration=60)
|
183 |
def roformer_separator(audio, model_key, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
184 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
185 |
roformer_model = roformer_models[model_key]
|
|
|
210 |
return stems[1], stems[0]
|
211 |
except Exception as e:
|
212 |
raise RuntimeError(f"Roformer separation failed: {e}") from e
|
213 |
+
|
214 |
+
@spaces.GPU(duration=60)
|
215 |
def mdxc_separator(audio, model, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
216 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
217 |
try:
|
|
|
242 |
except Exception as e:
|
243 |
raise RuntimeError(f"MDX23C separation failed: {e}") from e
|
244 |
|
245 |
+
@spaces.GPU(duration=60)
|
246 |
def mdxnet_separator(audio, model, out_format, hop_length, segment_size, denoise, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
247 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
248 |
try:
|
|
|
274 |
except Exception as e:
|
275 |
raise RuntimeError(f"MDX-NET separation failed: {e}") from e
|
276 |
|
277 |
+
@spaces.GPU(duration=60)
|
278 |
def vrarch_separator(audio, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
279 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
280 |
try:
|
|
|
308 |
except Exception as e:
|
309 |
raise RuntimeError(f"VR ARCH separation failed: {e}") from e
|
310 |
|
311 |
+
@spaces.GPU(duration=60)
|
312 |
def demucs_separator(audio, model, out_format, shifts, segment_size, segments_enabled, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
313 |
base_name = os.path.splitext(os.path.basename(audio))[0]
|
314 |
try:
|
|
|
350 |
else:
|
351 |
return gr.update(visible=False)
|
352 |
|
353 |
+
@spaces.GPU(duration=60)
|
354 |
def roformer_batch(path_input, path_output, model_key, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh):
|
355 |
found_files.clear()
|
356 |
logs.clear()
|
|
|
400 |
except Exception as e:
|
401 |
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
402 |
|
403 |
+
@spaces.GPU(duration=60)
|
404 |
def mdx23c_batch(path_input, path_output, model, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh):
|
405 |
found_files.clear()
|
406 |
logs.clear()
|
|
|
449 |
except Exception as e:
|
450 |
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
451 |
|
452 |
+
@spaces.GPU(duration=60)
|
453 |
def mdxnet_batch(path_input, path_output, model, out_format, hop_length, segment_size, denoise, overlap, batch_size, norm_thresh, amp_thresh):
|
454 |
found_files.clear()
|
455 |
logs.clear()
|
|
|
499 |
except Exception as e:
|
500 |
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
501 |
|
502 |
+
@spaces.GPU(duration=60)
|
503 |
def vrarch_batch(path_input, path_output, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh):
|
504 |
found_files.clear()
|
505 |
logs.clear()
|
|
|
551 |
except Exception as e:
|
552 |
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
553 |
|
554 |
+
@spaces.GPU(duration=60)
|
555 |
def demucs_batch(path_input, path_output, model, out_format, shifts, segment_size, segments_enabled, overlap, batch_size, norm_thresh, amp_thresh):
|
556 |
found_files.clear()
|
557 |
logs.clear()
|
|
|
603 |
with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "π΅ UVR5 UI π΅") as app:
|
604 |
with Translate("assets/languages/translation.yaml", placeholder_langs = ["en", "es", "it", "pt", "ms", "id", "ru", "uk", "th", "zh", "ja", "ko", "tr", "hi"]) as lang:
|
605 |
gr.Markdown("<h1> π΅ UVR5 UI π΅ </h1>")
|
606 |
+
gr.Markdown("If you liked this HF Space you can give me a β€οΈ")
|
607 |
+
gr.Markdown("Try UVR5 UI using Colab [here](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)")
|
608 |
with gr.Tabs():
|
609 |
with gr.TabItem("BS/Mel Roformer"):
|
610 |
with gr.Row():
|