jsd219 commited on
Commit
ac2c136
·
verified ·
1 Parent(s): 061c59d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -14,7 +14,8 @@ def estimate_genre(filepath):
14
 
15
  try:
16
  # Tempo
17
- tempo, _ = librosa.beat.beat_track(y=y, sr=sr)
 
18
 
19
  # Spectral centroid (brightness)
20
  centroid = librosa.feature.spectral_centroid(y=y, sr=sr)
@@ -51,7 +52,7 @@ def estimate_genre(filepath):
51
 
52
  return {
53
  "Predicted Genre": genre,
54
- "Tempo (BPM)": round(tempo, 1),
55
  "Brightness (Centroid Mean)": round(centroid_mean, 1),
56
  "Brightness (Centroid Std)": round(centroid_std, 1),
57
  "Chroma Mean": round(chroma_mean, 3),
 
14
 
15
  try:
16
  # Tempo
17
+ tempo_array, _ = librosa.beat.beat_track(y=y, sr=sr)
18
+ tempo = float(tempo_array)
19
 
20
  # Spectral centroid (brightness)
21
  centroid = librosa.feature.spectral_centroid(y=y, sr=sr)
 
52
 
53
  return {
54
  "Predicted Genre": genre,
55
+ "Tempo (BPM)": round(float(tempo), 1),
56
  "Brightness (Centroid Mean)": round(centroid_mean, 1),
57
  "Brightness (Centroid Std)": round(centroid_std, 1),
58
  "Chroma Mean": round(chroma_mean, 3),