Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -43,19 +43,21 @@ HEADER = """
|
|
43 |
|
44 |
CACHE_EXAMPLES = os.getenv('CACHE_EXAMPLES', '1') == '1'
|
45 |
|
|
|
46 |
|
47 |
def analyze(path):
|
48 |
#Measure time for inference
|
49 |
start = time.time()
|
50 |
|
51 |
path = Path(path)
|
52 |
-
result
|
53 |
path,
|
54 |
out_dir='./struct',
|
55 |
multiprocess=False,
|
56 |
keep_byproducts=True, # TODO: remove this
|
57 |
)
|
58 |
|
|
|
59 |
|
60 |
#fig = allin1.visualize(
|
61 |
# result,
|
@@ -73,7 +75,20 @@ def analyze(path):
|
|
73 |
#Measure time for inference
|
74 |
end = time.time()
|
75 |
elapsed_time = end-start
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
#return result.bpm, fig, sonif_path, elapsed_time
|
78 |
return result.bpm, elapsed_time, bass_path, drums_path, other_path, vocals_path
|
79 |
|
|
|
43 |
|
44 |
CACHE_EXAMPLES = os.getenv('CACHE_EXAMPLES', '1') == '1'
|
45 |
|
46 |
+
base_dir = "/tmp/gradio/"
|
47 |
|
48 |
def analyze(path):
|
49 |
#Measure time for inference
|
50 |
start = time.time()
|
51 |
|
52 |
path = Path(path)
|
53 |
+
result= allin1.analyze(
|
54 |
path,
|
55 |
out_dir='./struct',
|
56 |
multiprocess=False,
|
57 |
keep_byproducts=True, # TODO: remove this
|
58 |
)
|
59 |
|
60 |
+
|
61 |
|
62 |
#fig = allin1.visualize(
|
63 |
# result,
|
|
|
75 |
#Measure time for inference
|
76 |
end = time.time()
|
77 |
elapsed_time = end-start
|
78 |
+
|
79 |
+
bass_path, drums_path, other_path, vocals_path = None, None, None, None
|
80 |
+
for root, dirs, files in os.walk(base_dir):
|
81 |
+
for file_name in files:
|
82 |
+
file_path = os.path.join(root, file_name)
|
83 |
+
if "bass.wav" in file_path:
|
84 |
+
bass_path = file_path
|
85 |
+
if "vocals.wav" in file_path:
|
86 |
+
vocals_path = file_path
|
87 |
+
if "bass.wav" in file_path:
|
88 |
+
other_path = file_path
|
89 |
+
if "bass.wav" in file_path:
|
90 |
+
drums_path = file_path
|
91 |
+
|
92 |
#return result.bpm, fig, sonif_path, elapsed_time
|
93 |
return result.bpm, elapsed_time, bass_path, drums_path, other_path, vocals_path
|
94 |
|