Spaces:
Running
Running
JacobLinCool
commited on
Commit
•
015a5f1
1
Parent(s):
3b574d5
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import zipfile
|
|
3 |
import os
|
4 |
import tempfile
|
5 |
import shutil
|
6 |
-
from glob import glob
|
7 |
from infer.modules.train.preprocess import PreProcess, preprocess_trainset
|
8 |
from infer.modules.train.extract.extract_f0_rmvpe import FeatureInput
|
9 |
from zero import zero
|
@@ -13,9 +12,13 @@ def extract_audio_files(zip_file: str, target_dir: str) -> list[str]:
|
|
13 |
with zipfile.ZipFile(zip_file, "r") as zip_ref:
|
14 |
zip_ref.extractall(target_dir)
|
15 |
|
16 |
-
audio_files =
|
|
|
|
|
|
|
|
|
17 |
if not audio_files:
|
18 |
-
raise gr.Error("No audio files found
|
19 |
|
20 |
return audio_files
|
21 |
|
|
|
3 |
import os
|
4 |
import tempfile
|
5 |
import shutil
|
|
|
6 |
from infer.modules.train.preprocess import PreProcess, preprocess_trainset
|
7 |
from infer.modules.train.extract.extract_f0_rmvpe import FeatureInput
|
8 |
from zero import zero
|
|
|
12 |
with zipfile.ZipFile(zip_file, "r") as zip_ref:
|
13 |
zip_ref.extractall(target_dir)
|
14 |
|
15 |
+
audio_files = [
|
16 |
+
os.path.join(target_dir, f)
|
17 |
+
for f in os.listdir(target_dir)
|
18 |
+
if f.endswith((".wav", ".mp3", ".ogg"))
|
19 |
+
]
|
20 |
if not audio_files:
|
21 |
+
raise gr.Error("No audio files found at the top level of the zip file")
|
22 |
|
23 |
return audio_files
|
24 |
|