ron-hf commited on
Commit
b4dd7e7
·
1 Parent(s): ae81d84

Update app UI

Browse files
app.py CHANGED
@@ -29,7 +29,7 @@ if os.path.isfile("transfer.pth") == False:
29
  "orchestra.wav",
30
  )
31
 
32
- device = "cuda:0" if torch.cuda.is_available() else "cpu"
33
 
34
  example_list = ["folk.wav", "electronic.mp3", "orchestra.wav"]
35
  model = BartCaptionModel(max_length=128)
@@ -96,7 +96,13 @@ def captioning(audio_path):
96
  return inference
97
 
98
 
99
- title = "Interactive demo: Music Captioning 🤖🎵"
 
 
 
 
 
 
100
  description = """
101
  <p style='text-align: center'> LP-MusicCaps: LLM-Based Pseudo Music Captioning</p>
102
  <p style='text-align: center'> SeungHeon Doh, Keunwoo Choi, Jongpil Lee, Juhan Nam, ISMIR 2023</p>
@@ -115,9 +121,11 @@ demo = gr.Interface(
115
  ],
116
  examples=example_list,
117
  title=title,
 
118
  description=description,
119
  article=article,
120
  cache_examples=False,
 
121
  )
122
 
123
  demo.launch()
 
29
  "orchestra.wav",
30
  )
31
 
32
+ device = "cuda" if torch.cuda.is_available() else "cpu"
33
 
34
  example_list = ["folk.wav", "electronic.mp3", "orchestra.wav"]
35
  model = BartCaptionModel(max_length=128)
 
96
  return inference
97
 
98
 
99
+ def load_css():
100
+ with open("static/css/musicapp.css", "r") as file:
101
+ css_content = file.read()
102
+ return css_content
103
+
104
+
105
+ title = "Capabara - Interactive demo: Music Captioning 🤖🎵"
106
  description = """
107
  <p style='text-align: center'> LP-MusicCaps: LLM-Based Pseudo Music Captioning</p>
108
  <p style='text-align: center'> SeungHeon Doh, Keunwoo Choi, Jongpil Lee, Juhan Nam, ISMIR 2023</p>
 
121
  ],
122
  examples=example_list,
123
  title=title,
124
+ theme=gr.themes.Default(font=[gr.themes.GoogleFont("Work Sans"), "sans-serif"]),
125
  description=description,
126
  article=article,
127
  cache_examples=False,
128
+ css=load_css(),
129
  )
130
 
131
  demo.launch()
requirements.txt CHANGED
@@ -1,7 +1,79 @@
1
- --extra-index-url https://download.pytorch.org/whl/cpu
2
- torch==1.13.1
3
- torchaudio==0.13.1
4
- transformers==4.42.0
5
- librosa>=0.8
 
 
 
 
 
 
 
 
 
6
  gradio==5.8.0
7
- numpy<2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.2.1
2
+ annotated-types==0.7.0
3
+ anyio==4.8.0
4
+ audioread==3.0.1
5
+ certifi==2024.12.14
6
+ cffi==1.17.1
7
+ charset-normalizer==3.4.1
8
+ click==8.1.8
9
+ colorama==0.4.6
10
+ decorator==5.1.1
11
+ fastapi==0.115.6
12
+ ffmpy==0.5.0
13
+ filelock==3.16.1
14
+ fsspec==2024.12.0
15
  gradio==5.8.0
16
+ gradio_client==1.5.1
17
+ h11==0.14.0
18
+ httpcore==1.0.7
19
+ httpx==0.28.1
20
+ huggingface-hub==0.27.1
21
+ idna==3.10
22
+ Jinja2==3.1.5
23
+ joblib==1.4.2
24
+ lazy_loader==0.4
25
+ librosa==0.10.2.post1
26
+ llvmlite==0.43.0
27
+ markdown-it-py==3.0.0
28
+ MarkupSafe==2.1.5
29
+ mdurl==0.1.2
30
+ mpmath==1.3.0
31
+ msgpack==1.1.0
32
+ networkx==3.4.2
33
+ numba==0.60.0
34
+ numpy==1.26.4
35
+ orjson==3.10.14
36
+ packaging==24.2
37
+ pandas==2.2.3
38
+ pillow==11.1.0
39
+ platformdirs==4.3.6
40
+ pooch==1.8.2
41
+ pycparser==2.22
42
+ pydantic==2.10.5
43
+ pydantic_core==2.27.2
44
+ pydub==0.25.1
45
+ Pygments==2.19.1
46
+ python-dateutil==2.9.0.post0
47
+ python-multipart==0.0.20
48
+ pytz==2024.2
49
+ PyYAML==6.0.2
50
+ regex==2024.11.6
51
+ requests==2.32.3
52
+ rich==13.9.4
53
+ ruff==0.9.1
54
+ safehttpx==0.1.6
55
+ safetensors==0.5.2
56
+ scikit-learn==1.6.1
57
+ scipy==1.15.1
58
+ semantic-version==2.10.0
59
+ setuptools==75.8.0
60
+ shellingham==1.5.4
61
+ six==1.17.0
62
+ sniffio==1.3.1
63
+ soundfile==0.13.0
64
+ soxr==0.5.0.post1
65
+ starlette==0.41.3
66
+ sympy==1.13.1
67
+ threadpoolctl==3.5.0
68
+ tokenizers==0.19.1
69
+ tomlkit==0.13.2
70
+ torch==2.5.1
71
+ torchaudio==2.5.1
72
+ tqdm==4.67.1
73
+ transformers==4.42.0
74
+ typer==0.15.1
75
+ typing_extensions==4.12.2
76
+ tzdata==2024.2
77
+ urllib3==2.3.0
78
+ uvicorn==0.34.0
79
+ websockets==14.1
static/assets/TM_Capabara_210622.png ADDED
static/css/musicapp.css ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+ background: #0c4a6e !important;
3
+ }
4
+
5
+ body > gradio-app {
6
+ background: transparent !important;
7
+ }
8
+
9
+ h1,
10
+ h4,
11
+ li,
12
+ p {
13
+ color: whitesmoke;
14
+ }
15
+
16
+ h1 {
17
+ text-align: center;
18
+ }
19
+
20
+ a {
21
+ color: #f2762e;
22
+ }
23
+
24
+ #capa-logo {
25
+ width: 11rem;
26
+ display: block;
27
+ margin: 0 auto 0 auto;
28
+ }
29
+
30
+ #capa-logo > div.image-container > button {
31
+ cursor: default;
32
+ }
33
+
34
+ #capa-logo > div.image-container > button:hover {
35
+ background-color: transparent !important;
36
+ }
37
+
38
+ #capa-logo > div.image-container > div {
39
+ display: none;
40
+ }
41
+
42
+ #capa-title > div.html-container {
43
+ padding: 0;
44
+ }
45
+
46
+ .secondary {
47
+ background: #f2762e;
48
+ border-color: #f2762e;
49
+ color: white;
50
+ }
51
+
52
+ .secondary:hover {
53
+ background: #fc9f53;
54
+ border-color: #fc9f53;
55
+ }
56
+
57
+ .label {
58
+ color: whitesmoke !important;
59
+ }
60
+
61
+ .gallery > button > div {
62
+ background: whitesmoke !important;
63
+ }