Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -73,6 +73,7 @@ def generate_spectrograms(audio_files):
|
|
73 |
def separate_music_file_wrapper(input_string, use_cpu, use_single_onnx, large_overlap, small_overlap, chunk_size, use_large_gpu):
|
74 |
input_files = []
|
75 |
|
|
|
76 |
if input_string.startswith("https://www.youtube.com") or input_string.startswith("https://youtu.be"):
|
77 |
output_file = download_youtube_video_as_wav(input_string)
|
78 |
if output_file is not None:
|
@@ -83,6 +84,14 @@ def separate_music_file_wrapper(input_string, use_cpu, use_single_onnx, large_ov
|
|
83 |
else:
|
84 |
raise ValueError("Invalid input! Please provide a valid YouTube link or a directory path.")
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
options = {
|
87 |
'input_audio': input_files,
|
88 |
'output_folder': 'results',
|
|
|
73 |
def separate_music_file_wrapper(input_string, use_cpu, use_single_onnx, large_overlap, small_overlap, chunk_size, use_large_gpu):
|
74 |
input_files = []
|
75 |
|
76 |
+
# Validate YouTube URL or directory path
|
77 |
if input_string.startswith("https://www.youtube.com") or input_string.startswith("https://youtu.be"):
|
78 |
output_file = download_youtube_video_as_wav(input_string)
|
79 |
if output_file is not None:
|
|
|
84 |
else:
|
85 |
raise ValueError("Invalid input! Please provide a valid YouTube link or a directory path.")
|
86 |
|
87 |
+
# Validate overlap values
|
88 |
+
if not (0 <= large_overlap <= 1) or not (0 <= small_overlap <= 1):
|
89 |
+
raise ValueError("Overlap values must be between 0 and 1.")
|
90 |
+
|
91 |
+
# Validate chunk size
|
92 |
+
if chunk_size <= 0:
|
93 |
+
raise ValueError("Chunk size must be greater than 0.") # not thicc enough
|
94 |
+
|
95 |
options = {
|
96 |
'input_audio': input_files,
|
97 |
'output_folder': 'results',
|