Spaces:
Paused
Paused
Commit
•
1febb2e
1
Parent(s):
effe894
Update main.py
Browse files
main.py
CHANGED
@@ -18,7 +18,8 @@ separator = Separator(output_dir=tmp_directory, log_level=logging.INFO)
|
|
18 |
logging.getLogger().setLevel(logging.INFO)
|
19 |
separator.load_model("UVR-MDX-NET-Inst_Main.onnx")
|
20 |
|
21 |
-
|
|
|
22 |
|
23 |
|
24 |
class IsolationRequest(BaseModel):
|
@@ -44,7 +45,7 @@ async def isolate_voice(request: IsolationRequest):
|
|
44 |
primary_stem_output_path,
|
45 |
secondary_stem_output_path,
|
46 |
) = await asyncio.get_event_loop().run_in_executor(
|
47 |
-
|
48 |
separator.separate,
|
49 |
extracted_audio_path,
|
50 |
)
|
@@ -76,7 +77,7 @@ async def extract_audio(
|
|
76 |
):
|
77 |
start_time = datetime.now()
|
78 |
await asyncio.get_event_loop().run_in_executor(
|
79 |
-
|
80 |
lambda: ffmpeg.input(media_url, ss=start_seconds)
|
81 |
.output(output_path, format="wav", t=duration_seconds)
|
82 |
.global_args("-loglevel", "error", "-hide_banner")
|
|
|
18 |
logging.getLogger().setLevel(logging.INFO)
|
19 |
separator.load_model("UVR-MDX-NET-Inst_Main.onnx")
|
20 |
|
21 |
+
extractionExecuter = ThreadPoolExecutor(max_workers=8)
|
22 |
+
ffmpegExecuter = ThreadPoolExecutor(max_workers=8)
|
23 |
|
24 |
|
25 |
class IsolationRequest(BaseModel):
|
|
|
45 |
primary_stem_output_path,
|
46 |
secondary_stem_output_path,
|
47 |
) = await asyncio.get_event_loop().run_in_executor(
|
48 |
+
extractionExecuter,
|
49 |
separator.separate,
|
50 |
extracted_audio_path,
|
51 |
)
|
|
|
77 |
):
|
78 |
start_time = datetime.now()
|
79 |
await asyncio.get_event_loop().run_in_executor(
|
80 |
+
ffmpegExecuter, # Uses the default executor
|
81 |
lambda: ffmpeg.input(media_url, ss=start_seconds)
|
82 |
.output(output_path, format="wav", t=duration_seconds)
|
83 |
.global_args("-loglevel", "error", "-hide_banner")
|