Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,8 @@ import gradio as gr
|
|
16 |
## lets load the model
|
17 |
model = keras.models.load_model('heartbeatsound_classification.h5')
|
18 |
|
19 |
-
def loading_sound_file(sound_file):
|
|
|
20 |
X, sr = librosa.load(sound_file, sr=sr, duration=duration)
|
21 |
dur = librosa.get_duration(y=X, sr=sr)
|
22 |
|
@@ -34,9 +35,7 @@ def loading_sound_file(sound_file):
|
|
34 |
|
35 |
|
36 |
def heart_signal_classification(data):
|
37 |
-
|
38 |
-
X = np.array([x])
|
39 |
-
X = preprocess_input(X)
|
40 |
pred = model.predict(X)
|
41 |
result = pred[0].argmax()
|
42 |
## lets create our labels
|
|
|
16 |
## lets load the model
|
17 |
model = keras.models.load_model('heartbeatsound_classification.h5')
|
18 |
|
19 |
+
def loading_sound_file(sound_file, sr=22050, duration=10):
|
20 |
+
input_length = sr * duration
|
21 |
X, sr = librosa.load(sound_file, sr=sr, duration=duration)
|
22 |
dur = librosa.get_duration(y=X, sr=sr)
|
23 |
|
|
|
35 |
|
36 |
|
37 |
def heart_signal_classification(data):
|
38 |
+
X = loading_sound_file(data)
|
|
|
|
|
39 |
pred = model.predict(X)
|
40 |
result = pred[0].argmax()
|
41 |
## lets create our labels
|