Kholykoko commited on
Commit
feff2d4
1 Parent(s): 6fa1316

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. requirements.txt +2 -1
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import librosa
3
  from tensorflow.keras.models import load_model
4
  import numpy as np
5
-
6
  # load model
7
  model = load_model("BBNN_model.hdf5")
8
 
@@ -35,7 +35,7 @@ def get_melspec_feature(X, target_sr, frame_size, frame_shift_len, n_mels):
35
 
36
 
37
  def predict_genre(audio):
38
- audio, _ = librosa.load(y = audio, sr = 22050)
39
  melspec = get_melspec_feature(audio, target_sr, frame_size, frame_shift_len, n_mels)
40
  prediction = model.predict(melspec)[0]
41
  return {genre_classes[i]: float(prediction[i]) for i in range(5)}
 
2
  import librosa
3
  from tensorflow.keras.models import load_model
4
  import numpy as np
5
+ import audio2numpy as a2n
6
  # load model
7
  model = load_model("BBNN_model.hdf5")
8
 
 
35
 
36
 
37
  def predict_genre(audio):
38
+ print(audio)
39
  melspec = get_melspec_feature(audio, target_sr, frame_size, frame_shift_len, n_mels)
40
  prediction = model.predict(melspec)[0]
41
  return {genre_classes[i]: float(prediction[i]) for i in range(5)}
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
  tensorflow
2
  librosa
3
- numpy
 
 
1
  tensorflow
2
  librosa
3
+ numpy
4
+ audio2numpy