ui update
Browse files
app.py
CHANGED
|
@@ -76,142 +76,75 @@ def predict(audio_file, model_name):
|
|
| 76 |
return process_audio(audio_file, model_name)
|
| 77 |
|
| 78 |
|
| 79 |
-
#
|
| 80 |
css = """
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
--border-color: #333333;
|
| 88 |
-
--analyze-button-color: #ffa500;
|
| 89 |
-
--analyze-button-hover: #ff8c00;
|
| 90 |
-
--accent-color: #4a78e5;
|
| 91 |
}
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
| 96 |
}
|
| 97 |
|
| 98 |
-
.
|
| 99 |
-
|
| 100 |
-
|
| 101 |
}
|
| 102 |
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
color: var(--text-color) !important;
|
| 106 |
}
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
|
|
|
| 110 |
}
|
| 111 |
|
| 112 |
-
/*
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
font-size: 16px !important;
|
| 120 |
-
border-radius: 8px !important;
|
| 121 |
}
|
| 122 |
|
| 123 |
-
button#submit_btn:hover {
|
| 124 |
-
background-color: var(--analyze-button-hover) !important;
|
| 125 |
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5) !important;
|
| 126 |
-
transform: translateY(-2px) !important;
|
| 127 |
-
transition: all 0.2s ease !important;
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
/* Panel backgrounds */
|
| 131 |
-
.gr-panel, .gr-box, .gr-form, .gr-input-label, .gr-input {
|
| 132 |
-
background-color: var(--panel-bg) !important;
|
| 133 |
-
border: 1px solid var(--border-color) !important;
|
| 134 |
-
border-radius: 8px !important;
|
| 135 |
-
color: var(--text-color) !important;
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
/* Results panel */
|
| 139 |
-
#output {
|
| 140 |
-
background-color: var(--panel-bg) !important;
|
| 141 |
-
border-radius: 8px !important;
|
| 142 |
-
padding: 10px !important;
|
| 143 |
-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3) !important;
|
| 144 |
-
border: 1px solid var(--border-color) !important;
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
/* Resource links */
|
| 148 |
.resource-link {
|
| 149 |
-
background-color:
|
| 150 |
-
color:
|
| 151 |
-
border: 1px solid
|
| 152 |
-
padding: 8px 16px
|
| 153 |
-
border-radius: 20px
|
| 154 |
-
margin: 5px
|
| 155 |
-
text-decoration: none
|
| 156 |
-
display: inline-block
|
| 157 |
-
font-weight: 500
|
| 158 |
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3)
|
|
|
|
| 159 |
}
|
| 160 |
|
| 161 |
.resource-link:hover {
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
}
|
| 167 |
-
|
| 168 |
-
.header-container {
|
| 169 |
-
padding: 20px !important;
|
| 170 |
-
border-radius: 10px !important;
|
| 171 |
-
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
|
| 172 |
-
margin-bottom: 20px !important;
|
| 173 |
-
border: 1px solid var(--border-color) !important;
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
/* Accordion styling */
|
| 177 |
-
.gr-accordion {
|
| 178 |
-
border: 1px solid var(--border-color) !important;
|
| 179 |
-
border-radius: 8px !important;
|
| 180 |
-
overflow: hidden !important;
|
| 181 |
-
background-color: var(--panel-bg) !important;
|
| 182 |
-
}
|
| 183 |
-
|
| 184 |
-
.gr-accordion-header {
|
| 185 |
-
background-color: var(--secondary-bg) !important;
|
| 186 |
-
padding: 10px 15px !important;
|
| 187 |
-
font-weight: 600 !important;
|
| 188 |
-
color: var(--text-color) !important;
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
-
/* Audio player */
|
| 192 |
-
.audio-player {
|
| 193 |
-
background-color: var(--panel-bg) !important;
|
| 194 |
-
border-radius: 8px !important;
|
| 195 |
-
overflow: hidden !important;
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
/* Dropdown & Input fields */
|
| 199 |
-
select, input, .gr-dropdown {
|
| 200 |
-
background-color: var(--panel-bg) !important;
|
| 201 |
-
color: var(--text-color) !important;
|
| 202 |
-
border: 1px solid var(--border-color) !important;
|
| 203 |
}
|
| 204 |
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
color: var(--text-secondary) !important;
|
| 208 |
}
|
| 209 |
|
| 210 |
/* Footer styling */
|
| 211 |
-
.footer {
|
| 212 |
-
|
| 213 |
-
margin-top: 30px
|
| 214 |
-
padding: 15px
|
| 215 |
}
|
| 216 |
"""
|
| 217 |
|
|
@@ -220,14 +153,13 @@ with gr.Blocks(css=css, theme=gr.themes.Ocean()) as demo:
|
|
| 220 |
# Title and Logo
|
| 221 |
gr.HTML(
|
| 222 |
"""
|
| 223 |
-
<div class="header
|
| 224 |
<div style="display: flex; justify-content: center; margin-bottom: 20px;">
|
| 225 |
-
<img src="https://i.postimg.cc/3Jx3yZ5b/real-vs-fake-sonics-w-logo.jpg"
|
| 226 |
-
style="max-width: 150px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,0.3);">
|
| 227 |
</div>
|
| 228 |
-
<h1
|
| 229 |
-
<h3
|
| 230 |
-
<p
|
| 231 |
Detect if a song is real or AI-generated with our state-of-the-art models.
|
| 232 |
Simply upload an audio file to verify its authenticity!
|
| 233 |
</p>
|
|
@@ -235,24 +167,24 @@ with gr.Blocks(css=css, theme=gr.themes.Ocean()) as demo:
|
|
| 235 |
"""
|
| 236 |
)
|
| 237 |
|
| 238 |
-
# Resource Links -
|
| 239 |
gr.HTML(
|
| 240 |
"""
|
| 241 |
-
<div
|
| 242 |
<a href="https://openreview.net/forum?id=PY7KSh29Z8" target="_blank" class="resource-link">
|
| 243 |
-
|
| 244 |
</a>
|
| 245 |
<a href="https://huggingface.co/datasets/awsaf49/sonics" target="_blank" class="resource-link">
|
| 246 |
-
|
| 247 |
</a>
|
| 248 |
<a href="https://huggingface.co/collections/awsaf49/sonics-spectttra-67bb6517b3920fd18e409013" target="_blank" class="resource-link">
|
| 249 |
-
|
| 250 |
</a>
|
| 251 |
<a href="https://arxiv.org/abs/2408.14080" target="_blank" class="resource-link">
|
| 252 |
-
|
| 253 |
</a>
|
| 254 |
<a href="https://github.com/awsaf49/sonics" target="_blank" class="resource-link">
|
| 255 |
-
|
| 256 |
</a>
|
| 257 |
</div>
|
| 258 |
"""
|
|
@@ -264,8 +196,7 @@ with gr.Blocks(css=css, theme=gr.themes.Ocean()) as demo:
|
|
| 264 |
audio_input = gr.Audio(
|
| 265 |
label="Upload Audio File",
|
| 266 |
type="filepath",
|
| 267 |
-
elem_id="audio_input"
|
| 268 |
-
elem_classes="audio-player"
|
| 269 |
)
|
| 270 |
|
| 271 |
model_dropdown = gr.Dropdown(
|
|
@@ -320,9 +251,9 @@ with gr.Blocks(css=css, theme=gr.themes.Ocean()) as demo:
|
|
| 320 |
# Footer
|
| 321 |
gr.HTML(
|
| 322 |
"""
|
| 323 |
-
<div class="footer"
|
| 324 |
-
<p
|
| 325 |
-
<p style="
|
| 326 |
</div>
|
| 327 |
"""
|
| 328 |
)
|
|
@@ -331,5 +262,4 @@ with gr.Blocks(css=css, theme=gr.themes.Ocean()) as demo:
|
|
| 331 |
submit_btn.click(fn=predict, inputs=[audio_input, model_dropdown], outputs=[output])
|
| 332 |
|
| 333 |
if __name__ == "__main__":
|
| 334 |
-
# Use dark theme as base and then apply custom CSS on top
|
| 335 |
demo.launch()
|
|
|
|
| 76 |
return process_audio(audio_file, model_name)
|
| 77 |
|
| 78 |
|
| 79 |
+
# Updated CSS with better color scheme for resource links
|
| 80 |
css = """
|
| 81 |
+
/* Custom CSS that works with Ocean theme */
|
| 82 |
+
.sonics-header {
|
| 83 |
+
text-align: center;
|
| 84 |
+
padding: 20px;
|
| 85 |
+
margin-bottom: 20px;
|
| 86 |
+
border-radius: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
}
|
| 88 |
|
| 89 |
+
.sonics-logo {
|
| 90 |
+
max-width: 150px;
|
| 91 |
+
border-radius: 10px;
|
| 92 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
|
| 93 |
}
|
| 94 |
|
| 95 |
+
.sonics-title {
|
| 96 |
+
font-size: 28px;
|
| 97 |
+
margin-bottom: 10px;
|
| 98 |
}
|
| 99 |
|
| 100 |
+
.sonics-subtitle {
|
| 101 |
+
margin-bottom: 15px;
|
|
|
|
| 102 |
}
|
| 103 |
|
| 104 |
+
.sonics-description {
|
| 105 |
+
font-size: 16px;
|
| 106 |
+
margin: 0;
|
| 107 |
}
|
| 108 |
|
| 109 |
+
/* Resource links styling */
|
| 110 |
+
.resource-links {
|
| 111 |
+
display: flex;
|
| 112 |
+
justify-content: center;
|
| 113 |
+
flex-wrap: wrap;
|
| 114 |
+
gap: 8px;
|
| 115 |
+
margin-bottom: 25px;
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
.resource-link {
|
| 119 |
+
background-color: #222222;
|
| 120 |
+
color: #4aedd6;
|
| 121 |
+
border: 1px solid #333333;
|
| 122 |
+
padding: 8px 16px;
|
| 123 |
+
border-radius: 20px;
|
| 124 |
+
margin: 5px;
|
| 125 |
+
text-decoration: none;
|
| 126 |
+
display: inline-block;
|
| 127 |
+
font-weight: 500;
|
| 128 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
| 129 |
+
transition: all 0.2s ease;
|
| 130 |
}
|
| 131 |
|
| 132 |
.resource-link:hover {
|
| 133 |
+
background-color: #333333;
|
| 134 |
+
transform: translateY(-2px);
|
| 135 |
+
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
|
| 136 |
+
transition: all 0.2s ease;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
}
|
| 138 |
|
| 139 |
+
.resource-link-icon {
|
| 140 |
+
margin-right: 5px;
|
|
|
|
| 141 |
}
|
| 142 |
|
| 143 |
/* Footer styling */
|
| 144 |
+
.sonics-footer {
|
| 145 |
+
text-align: center;
|
| 146 |
+
margin-top: 30px;
|
| 147 |
+
padding: 15px;
|
| 148 |
}
|
| 149 |
"""
|
| 150 |
|
|
|
|
| 153 |
# Title and Logo
|
| 154 |
gr.HTML(
|
| 155 |
"""
|
| 156 |
+
<div class="sonics-header">
|
| 157 |
<div style="display: flex; justify-content: center; margin-bottom: 20px;">
|
| 158 |
+
<img src="https://i.postimg.cc/3Jx3yZ5b/real-vs-fake-sonics-w-logo.jpg" class="sonics-logo">
|
|
|
|
| 159 |
</div>
|
| 160 |
+
<h1 class="sonics-title">SONICS: Synthetic Or Not - Identifying Counterfeit Songs</h1>
|
| 161 |
+
<h3 class="sonics-subtitle">ICLR 2025 [Poster]</h3>
|
| 162 |
+
<p class="sonics-description">
|
| 163 |
Detect if a song is real or AI-generated with our state-of-the-art models.
|
| 164 |
Simply upload an audio file to verify its authenticity!
|
| 165 |
</p>
|
|
|
|
| 167 |
"""
|
| 168 |
)
|
| 169 |
|
| 170 |
+
# Resource Links - Updated with custom styling to match screenshot
|
| 171 |
gr.HTML(
|
| 172 |
"""
|
| 173 |
+
<div class="resource-links">
|
| 174 |
<a href="https://openreview.net/forum?id=PY7KSh29Z8" target="_blank" class="resource-link">
|
| 175 |
+
<span class="resource-link-icon">π</span>Paper
|
| 176 |
</a>
|
| 177 |
<a href="https://huggingface.co/datasets/awsaf49/sonics" target="_blank" class="resource-link">
|
| 178 |
+
<span class="resource-link-icon">π΅</span>Dataset
|
| 179 |
</a>
|
| 180 |
<a href="https://huggingface.co/collections/awsaf49/sonics-spectttra-67bb6517b3920fd18e409013" target="_blank" class="resource-link">
|
| 181 |
+
<span class="resource-link-icon">π€</span>Models
|
| 182 |
</a>
|
| 183 |
<a href="https://arxiv.org/abs/2408.14080" target="_blank" class="resource-link">
|
| 184 |
+
<span class="resource-link-icon">π¬</span>ArXiv
|
| 185 |
</a>
|
| 186 |
<a href="https://github.com/awsaf49/sonics" target="_blank" class="resource-link">
|
| 187 |
+
<span class="resource-link-icon">π»</span>GitHub
|
| 188 |
</a>
|
| 189 |
</div>
|
| 190 |
"""
|
|
|
|
| 196 |
audio_input = gr.Audio(
|
| 197 |
label="Upload Audio File",
|
| 198 |
type="filepath",
|
| 199 |
+
elem_id="audio_input"
|
|
|
|
| 200 |
)
|
| 201 |
|
| 202 |
model_dropdown = gr.Dropdown(
|
|
|
|
| 251 |
# Footer
|
| 252 |
gr.HTML(
|
| 253 |
"""
|
| 254 |
+
<div class="sonics-footer">
|
| 255 |
+
<p>SONICS: Synthetic Or Not - Identifying Counterfeit Songs | ICLR 2025</p>
|
| 256 |
+
<p style="font-size: 12px;">For research purposes only</p>
|
| 257 |
</div>
|
| 258 |
"""
|
| 259 |
)
|
|
|
|
| 262 |
submit_btn.click(fn=predict, inputs=[audio_input, model_dropdown], outputs=[output])
|
| 263 |
|
| 264 |
if __name__ == "__main__":
|
|
|
|
| 265 |
demo.launch()
|