Spaces:
Running
Running
Commit
·
1b12cb6
1
Parent(s):
0c7827c
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import librosa
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
def classify_audio(filepath):
|
| 9 |
-
|
| 10 |
-
preds = pipe(audio)
|
| 11 |
outputs = {}
|
| 12 |
for p in preds:
|
| 13 |
outputs[p["label"]] = p["score"]
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
model_id = "lewtun/distilhubert-finetuned-gtzan"
|
| 5 |
+
pipe = pipeline("audio-classification", model=model_id)
|
| 6 |
|
| 7 |
|
| 8 |
def classify_audio(filepath):
|
| 9 |
+
preds = pipe(filepath)
|
|
|
|
| 10 |
outputs = {}
|
| 11 |
for p in preds:
|
| 12 |
outputs[p["label"]] = p["score"]
|