app_dcase.py requirements.txt: go back to simple demo with CLAP twice, place dcase baseline in dedicated branch until installation is solved
Browse files- app_dcase.py +18 -34
- requirements.txt +0 -6
app_dcase.py
CHANGED
@@ -1,40 +1,26 @@
|
|
1 |
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
# clap_model = CLAP(version = 'clapcap', use_cuda=False)
|
6 |
-
|
7 |
-
# def clap_inference(mic=None, file=None):
|
8 |
-
|
9 |
-
# if mic is not None:
|
10 |
-
# audio = mic
|
11 |
-
# elif file is not None:
|
12 |
-
# audio = file
|
13 |
-
# else:
|
14 |
-
# return "You must either provide a mic recording or a file"
|
15 |
|
16 |
-
|
17 |
-
# captions = clap_model.generate_caption([audio],
|
18 |
-
# resample=True,
|
19 |
-
# beam_size=5,
|
20 |
-
# entry_length=67,
|
21 |
-
# temperature=0.01)
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
import gdown
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
output = 'epoch_232-step_001864-mode_min-val_loss_3.3752.ckpt'
|
37 |
-
gdown.download(url, output, quiet=False)
|
38 |
|
39 |
def create_app():
|
40 |
|
@@ -45,7 +31,7 @@ def create_app():
|
|
45 |
"""
|
46 |
)
|
47 |
gr.Interface(
|
48 |
-
fn=
|
49 |
inputs=[
|
50 |
gr.Audio(sources="microphone", type="filepath"),
|
51 |
gr.Audio(sources="upload", type="filepath"),
|
@@ -55,8 +41,6 @@ def create_app():
|
|
55 |
|
56 |
return demo
|
57 |
|
58 |
-
download_dcase_model_checkpoint()
|
59 |
-
|
60 |
def main():
|
61 |
|
62 |
app = create_app()
|
|
|
1 |
|
2 |
+
import gradio as gr
|
3 |
+
from msclap import CLAP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
clap_model = CLAP(version = 'clapcap', use_cuda=False)
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
+
def clap_inference(mic=None, file=None):
|
8 |
|
9 |
+
if mic is not None:
|
10 |
+
audio = mic
|
11 |
+
elif file is not None:
|
12 |
+
audio = file
|
13 |
+
else:
|
14 |
+
return "You must either provide a mic recording or a file"
|
|
|
15 |
|
16 |
+
# Generate captions for the recording
|
17 |
+
captions = clap_model.generate_caption([audio],
|
18 |
+
resample=True,
|
19 |
+
beam_size=5,
|
20 |
+
entry_length=67,
|
21 |
+
temperature=0.01)
|
22 |
|
23 |
+
return captions[0]
|
|
|
|
|
24 |
|
25 |
def create_app():
|
26 |
|
|
|
31 |
"""
|
32 |
)
|
33 |
gr.Interface(
|
34 |
+
fn=clap_inference,
|
35 |
inputs=[
|
36 |
gr.Audio(sources="microphone", type="filepath"),
|
37 |
gr.Audio(sources="upload", type="filepath"),
|
|
|
41 |
|
42 |
return demo
|
43 |
|
|
|
|
|
44 |
def main():
|
45 |
|
46 |
app = create_app()
|
requirements.txt
CHANGED
@@ -1,8 +1,2 @@
|
|
1 |
gradio==5.13.1
|
2 |
msclap
|
3 |
-
# transformers
|
4 |
-
# torch==2.2.1
|
5 |
-
# torchoutil[extras]~=0.3.0
|
6 |
-
# ffmpeg
|
7 |
-
# ffmpeg-python
|
8 |
-
git+https://github.com/Labbeti/dcase2024-task6-baseline
|
|
|
1 |
gradio==5.13.1
|
2 |
msclap
|
|
|
|
|
|
|
|
|
|
|
|