Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ import time
|
|
| 22 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 23 |
from threading import Lock
|
| 24 |
import scipy.io.wavfile
|
|
|
|
| 25 |
|
| 26 |
# Logging setup
|
| 27 |
logging.basicConfig(level=logging.INFO)
|
|
@@ -371,6 +372,7 @@ def download_audio(url, cookie_file=None):
|
|
| 371 |
os.remove(temp_output_path)
|
| 372 |
logger.info(f"Temporary file deleted: {temp_output_path}")
|
| 373 |
|
|
|
|
| 374 |
def roformer_separator(audio, model_key, seg_size, override_seg_size, overlap, pitch_shift, model_dir, output_dir, out_format, norm_thresh, amp_thresh, batch_size, exclude_stems="", progress=gr.Progress(track_tqdm=True)):
|
| 375 |
if not audio:
|
| 376 |
raise ValueError("No audio file provided.")
|
|
@@ -433,6 +435,7 @@ def roformer_separator(audio, model_key, seg_size, override_seg_size, overlap, p
|
|
| 433 |
torch.cuda.empty_cache()
|
| 434 |
logger.info("GPU memory cleared")
|
| 435 |
|
|
|
|
| 436 |
def auto_ensemble_process(audio, model_keys, seg_size=64, overlap=0.1, out_format="wav", use_tta="False", model_dir="/tmp/audio-separator-models/", output_dir="output", norm_thresh=0.9, amp_thresh=0.9, batch_size=1, ensemble_method="avg_wave", exclude_stems="", weights_str="", progress=gr.Progress(track_tqdm=True)):
|
| 437 |
temp_audio_path = None
|
| 438 |
max_retries = 2
|
|
|
|
| 22 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 23 |
from threading import Lock
|
| 24 |
import scipy.io.wavfile
|
| 25 |
+
import spaces
|
| 26 |
|
| 27 |
# Logging setup
|
| 28 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 372 |
os.remove(temp_output_path)
|
| 373 |
logger.info(f"Temporary file deleted: {temp_output_path}")
|
| 374 |
|
| 375 |
+
@spaces.GPU
|
| 376 |
def roformer_separator(audio, model_key, seg_size, override_seg_size, overlap, pitch_shift, model_dir, output_dir, out_format, norm_thresh, amp_thresh, batch_size, exclude_stems="", progress=gr.Progress(track_tqdm=True)):
|
| 377 |
if not audio:
|
| 378 |
raise ValueError("No audio file provided.")
|
|
|
|
| 435 |
torch.cuda.empty_cache()
|
| 436 |
logger.info("GPU memory cleared")
|
| 437 |
|
| 438 |
+
@spaces.GPU
|
| 439 |
def auto_ensemble_process(audio, model_keys, seg_size=64, overlap=0.1, out_format="wav", use_tta="False", model_dir="/tmp/audio-separator-models/", output_dir="output", norm_thresh=0.9, amp_thresh=0.9, batch_size=1, ensemble_method="avg_wave", exclude_stems="", weights_str="", progress=gr.Progress(track_tqdm=True)):
|
| 440 |
temp_audio_path = None
|
| 441 |
max_retries = 2
|