Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,13 +19,13 @@ def estimate_genre(filepath):
|
|
19 |
return {"Error": f"Feature extraction failed: {str(e)}"}
|
20 |
|
21 |
# Heuristic genre rules
|
22 |
-
if tempo > 140 and
|
23 |
genre = "Electronic / Dance"
|
24 |
elif tempo < 90 and chroma_strength < 0.3:
|
25 |
genre = "Hip Hop / Trap"
|
26 |
-
elif 100 < tempo < 130 and
|
27 |
genre = "Pop / Rock"
|
28 |
-
elif
|
29 |
genre = "Jazz / Soul"
|
30 |
else:
|
31 |
genre = "Unknown"
|
|
|
19 |
return {"Error": f"Feature extraction failed: {str(e)}"}
|
20 |
|
21 |
# Heuristic genre rules
|
22 |
+
if tempo > 140 and centroid > 2500:
|
23 |
genre = "Electronic / Dance"
|
24 |
elif tempo < 90 and chroma_strength < 0.3:
|
25 |
genre = "Hip Hop / Trap"
|
26 |
+
elif 100 < tempo < 130 and centroid > 2300 and chroma_strength > 0.7:
|
27 |
genre = "Pop / Rock"
|
28 |
+
elif centroid < 1800 and chroma_strength > 0.9:
|
29 |
genre = "Jazz / Soul"
|
30 |
else:
|
31 |
genre = "Unknown"
|