Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,17 +72,16 @@ pipe = pipeline("audio-classification", model=model_id, device=device)
|
|
| 72 |
|
| 73 |
def classify_audio(filepath):
|
| 74 |
|
| 75 |
-
|
| 76 |
preds = pipe(filepath)
|
| 77 |
# preds = predict_trunc(filepath)
|
| 78 |
outputs = {}
|
| 79 |
-
pred_time = round(timer() - start_time, 5)
|
| 80 |
for p in preds:
|
| 81 |
-
outputs[p["label"]] = p["score"]
|
| 82 |
return outputs
|
| 83 |
|
| 84 |
|
| 85 |
-
title = "
|
| 86 |
description = """
|
| 87 |
Demo for a music genre classifier trained on [GTZAN](https://huggingface.co/datasets/marsyas/gtzan)
|
| 88 |
For more info checkout [GITHUB](https://github.com/AEscF)
|
|
@@ -92,7 +91,7 @@ filenames = [[f"./{f}"] for f in filenames]
|
|
| 92 |
demo = gr.Interface(
|
| 93 |
fn=classify_audio,
|
| 94 |
inputs=gr.Audio(type="filepath"),
|
| 95 |
-
outputs=[gr.Label(label="Predictions")
|
| 96 |
title=title,
|
| 97 |
description=description,
|
| 98 |
examples=filenames,
|
|
|
|
| 72 |
|
| 73 |
def classify_audio(filepath):
|
| 74 |
|
| 75 |
+
|
| 76 |
preds = pipe(filepath)
|
| 77 |
# preds = predict_trunc(filepath)
|
| 78 |
outputs = {}
|
|
|
|
| 79 |
for p in preds:
|
| 80 |
+
outputs[p["label"]] = p["score"]
|
| 81 |
return outputs
|
| 82 |
|
| 83 |
|
| 84 |
+
title = "Music Genre Classifier"
|
| 85 |
description = """
|
| 86 |
Demo for a music genre classifier trained on [GTZAN](https://huggingface.co/datasets/marsyas/gtzan)
|
| 87 |
For more info checkout [GITHUB](https://github.com/AEscF)
|
|
|
|
| 91 |
demo = gr.Interface(
|
| 92 |
fn=classify_audio,
|
| 93 |
inputs=gr.Audio(type="filepath"),
|
| 94 |
+
outputs=[gr.Label(label="Predictions")],
|
| 95 |
title=title,
|
| 96 |
description=description,
|
| 97 |
examples=filenames,
|