modify
Browse files
app.py
CHANGED
|
@@ -67,17 +67,44 @@ def predict(audio_file, model_name):
|
|
| 67 |
|
| 68 |
# Create Gradio interface
|
| 69 |
with gr.Blocks() as demo:
|
|
|
|
| 70 |
gr.HTML(
|
| 71 |
"""
|
| 72 |
-
<div style="text-align: center;
|
| 73 |
<img src="https://i.postimg.cc/3Jx3yZ5b/real-vs-fake-sonics-w-logo.jpg"
|
| 74 |
-
style="max-width:
|
| 75 |
<h1>SONICS: Synthetic Or Not - Identifying Counterfeit Songs</h1>
|
| 76 |
<h3>ICLR 2025 [Poster]</h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
</div>
|
| 78 |
"""
|
| 79 |
)
|
| 80 |
|
|
|
|
| 81 |
with gr.Row():
|
| 82 |
with gr.Column():
|
| 83 |
audio_input = gr.Audio(
|
|
@@ -96,17 +123,20 @@ with gr.Blocks() as demo:
|
|
| 96 |
label="Analysis Result",
|
| 97 |
num_top_classes=2
|
| 98 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
-
|
| 101 |
-
"""
|
| 102 |
-
### Resources
|
| 103 |
-
- [π Paper](https://openreview.net/forum?id=PY7KSh29Z8)
|
| 104 |
-
- [π΅ Dataset](https://huggingface.co/datasets/awsaf49/sonics)
|
| 105 |
-
- [π¬ ArXiv](https://arxiv.org/abs/2408.14080)
|
| 106 |
-
- [π» GitHub](https://github.com/awsaf49/sonics)
|
| 107 |
-
"""
|
| 108 |
-
)
|
| 109 |
|
|
|
|
| 110 |
submit_btn.click(
|
| 111 |
fn=predict,
|
| 112 |
inputs=[audio_input, model_dropdown],
|
|
|
|
| 67 |
|
| 68 |
# Create Gradio interface
|
| 69 |
with gr.Blocks() as demo:
|
| 70 |
+
# Title, Subtitle, and Logo
|
| 71 |
gr.HTML(
|
| 72 |
"""
|
| 73 |
+
<div style="text-align: center;">
|
| 74 |
<img src="https://i.postimg.cc/3Jx3yZ5b/real-vs-fake-sonics-w-logo.jpg"
|
| 75 |
+
style="max-width: 150px; margin: 0 auto;">
|
| 76 |
<h1>SONICS: Synthetic Or Not - Identifying Counterfeit Songs</h1>
|
| 77 |
<h3>ICLR 2025 [Poster]</h3>
|
| 78 |
+
<p style="font-size: 1.1em; color: #666; margin: 10px 0;">
|
| 79 |
+
Detect if a song is real or AI-generated (created using text-to-song models).
|
| 80 |
+
Upload any audio file to check its authenticity!
|
| 81 |
+
</p>
|
| 82 |
+
</div>
|
| 83 |
+
"""
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
# Resource Links
|
| 87 |
+
with gr.Row():
|
| 88 |
+
paper_radio = gr.Radio(
|
| 89 |
+
choices=["Paper", "Dataset", "ArXiv", "GitHub"],
|
| 90 |
+
label="Resources",
|
| 91 |
+
info="Click to visit respective links"
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
gr.HTML(
|
| 95 |
+
"""
|
| 96 |
+
<div style="text-align: center; margin-bottom: 1rem;">
|
| 97 |
+
<p>
|
| 98 |
+
<a href="https://openreview.net/forum?id=PY7KSh29Z8" target="_blank">π Paper</a> |
|
| 99 |
+
<a href="https://huggingface.co/datasets/awsaf49/sonics" target="_blank">π΅ Dataset</a> |
|
| 100 |
+
<a href="https://arxiv.org/abs/2408.14080" target="_blank">π¬ ArXiv</a> |
|
| 101 |
+
<a href="https://github.com/awsaf49/sonics" target="_blank">π» GitHub</a>
|
| 102 |
+
</p>
|
| 103 |
</div>
|
| 104 |
"""
|
| 105 |
)
|
| 106 |
|
| 107 |
+
# Main Interface
|
| 108 |
with gr.Row():
|
| 109 |
with gr.Column():
|
| 110 |
audio_input = gr.Audio(
|
|
|
|
| 123 |
label="Analysis Result",
|
| 124 |
num_top_classes=2
|
| 125 |
)
|
| 126 |
+
|
| 127 |
+
# Link handling for resource radio buttons
|
| 128 |
+
def open_link(choice):
|
| 129 |
+
links = {
|
| 130 |
+
"Paper": "https://openreview.net/forum?id=PY7KSh29Z8",
|
| 131 |
+
"Dataset": "https://huggingface.co/datasets/awsaf49/sonics",
|
| 132 |
+
"ArXiv": "https://arxiv.org/abs/2408.14080",
|
| 133 |
+
"GitHub": "https://github.com/awsaf49/sonics"
|
| 134 |
+
}
|
| 135 |
+
gr.open_url(links[choice])
|
| 136 |
|
| 137 |
+
paper_radio.change(fn=open_link, inputs=[paper_radio])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
+
# Prediction handling
|
| 140 |
submit_btn.click(
|
| 141 |
fn=predict,
|
| 142 |
inputs=[audio_input, model_dropdown],
|