Spaces:
Running
on
Zero
Running
on
Zero
fix!: adapt the code to use Zero GPU
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import traceback
|
|
| 9 |
import logging
|
| 10 |
from inference import proc_folder_direct
|
| 11 |
from pathlib import Path
|
|
|
|
| 12 |
|
| 13 |
OUTPUT_FOLDER = "separation_results/"
|
| 14 |
INPUT_FOLDER = "input"
|
|
@@ -150,10 +151,11 @@ def delete_folders_and_files(input_dir):
|
|
| 150 |
|
| 151 |
print("Cleanup completed.")
|
| 152 |
|
|
|
|
| 153 |
def process_audio(uploaded_file):
|
| 154 |
try:
|
| 155 |
yield "Processing audio...", None
|
| 156 |
-
|
| 157 |
if uploaded_file:
|
| 158 |
input_path, formatted_title = handle_file_upload(uploaded_file)
|
| 159 |
if input_path is None:
|
|
@@ -166,7 +168,7 @@ def process_audio(uploaded_file):
|
|
| 166 |
|
| 167 |
yield "Starting Mel Band Roformer inference...", None
|
| 168 |
proc_folder_direct("mel_band_roformer", "configs/config_mel_band_roformer_vocals.yaml", "results/model_mel_band_roformer_vocals.ckpt", f"{INPUT_FOLDER}/wav", OUTPUT_FOLDER, extract_instrumental=True)
|
| 169 |
-
|
| 170 |
yield "Starting HTDemucs inference...", None
|
| 171 |
proc_folder_direct("htdemucs", "configs/config_htdemucs_bass.yaml", "results/model_htdemucs_bass.th", f"{INPUT_FOLDER}/wav", OUTPUT_FOLDER)
|
| 172 |
|
|
@@ -220,5 +222,5 @@ with gr.Blocks() as demo:
|
|
| 220 |
outputs=[log_output, processed_audio_output],
|
| 221 |
show_progress=True
|
| 222 |
)
|
| 223 |
-
|
| 224 |
demo.launch()
|
|
|
|
| 9 |
import logging
|
| 10 |
from inference import proc_folder_direct
|
| 11 |
from pathlib import Path
|
| 12 |
+
from transformers import pipeline
|
| 13 |
|
| 14 |
OUTPUT_FOLDER = "separation_results/"
|
| 15 |
INPUT_FOLDER = "input"
|
|
|
|
| 151 |
|
| 152 |
print("Cleanup completed.")
|
| 153 |
|
| 154 |
+
@spaces.GPU(duration=300) # Adjust the duration as needed
|
| 155 |
def process_audio(uploaded_file):
|
| 156 |
try:
|
| 157 |
yield "Processing audio...", None
|
| 158 |
+
|
| 159 |
if uploaded_file:
|
| 160 |
input_path, formatted_title = handle_file_upload(uploaded_file)
|
| 161 |
if input_path is None:
|
|
|
|
| 168 |
|
| 169 |
yield "Starting Mel Band Roformer inference...", None
|
| 170 |
proc_folder_direct("mel_band_roformer", "configs/config_mel_band_roformer_vocals.yaml", "results/model_mel_band_roformer_vocals.ckpt", f"{INPUT_FOLDER}/wav", OUTPUT_FOLDER, extract_instrumental=True)
|
| 171 |
+
|
| 172 |
yield "Starting HTDemucs inference...", None
|
| 173 |
proc_folder_direct("htdemucs", "configs/config_htdemucs_bass.yaml", "results/model_htdemucs_bass.th", f"{INPUT_FOLDER}/wav", OUTPUT_FOLDER)
|
| 174 |
|
|
|
|
| 222 |
outputs=[log_output, processed_audio_output],
|
| 223 |
show_progress=True
|
| 224 |
)
|
| 225 |
+
|
| 226 |
demo.launch()
|