Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,7 @@ pipe = pipeline("audio-classification", model=model_id, device=device)
|
|
| 17 |
|
| 18 |
|
| 19 |
def classify_audio(filepath):
|
|
|
|
| 20 |
"""
|
| 21 |
Goes from
|
| 22 |
[{'score': 0.8339303731918335, 'label': 'country'},
|
|
@@ -29,7 +30,9 @@ def classify_audio(filepath):
|
|
| 29 |
outputs = {}
|
| 30 |
for p in preds:
|
| 31 |
outputs[p["label"]] = p["score"]
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
title = "🎵 Music Genre Classifier"
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
def classify_audio(filepath):
|
| 20 |
+
start_time = timer()
|
| 21 |
"""
|
| 22 |
Goes from
|
| 23 |
[{'score': 0.8339303731918335, 'label': 'country'},
|
|
|
|
| 30 |
outputs = {}
|
| 31 |
for p in preds:
|
| 32 |
outputs[p["label"]] = p["score"]
|
| 33 |
+
|
| 34 |
+
pred_time = round(timer() - start_time, 5)
|
| 35 |
+
return outputs, pred_time
|
| 36 |
|
| 37 |
|
| 38 |
title = "🎵 Music Genre Classifier"
|