Spaces:
Sleeping
Sleeping
Added Gradio app
Browse files
app.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
model_id = 'hp1318/ast-finetuned-audioset-10-10-0.4593-finetuned-gtzan'
|
4 |
+
pipe = pipeline('audio-classification', model=model_id)
|
5 |
+
def classify_audio(filepath):
|
6 |
+
preds = pipe(filepath)
|
7 |
+
outputs = {p["label"]: p["score"] for p in preds}
|
8 |
+
return outputs
|
9 |
+
demo = gr.Interface(fn=classify_audio, inputs=gr.Audio(type="filepath"), outputs=gr.Label())
|
10 |
+
demo.launch()
|