Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -81,9 +81,7 @@ def inference(audio, model):
|
|
81 |
pred = model.predict(audio_sample, batch_size=1, verbose=0)
|
82 |
return input, pred.squeeze(), sr
|
83 |
|
84 |
-
def predict(audio
|
85 |
-
|
86 |
-
input = audio if audio is not None else micro
|
87 |
x, x_pred, sr = inference(audio, model)
|
88 |
fig, ax = plt.subplots(nrows=2, ncols=1, sharex=True, figsize=(10, 8), dpi=120)
|
89 |
D = librosa.amplitude_to_db(np.abs(librosa.stft(x)), ref=np.max)
|
@@ -100,13 +98,10 @@ def predict(audio, micro):
|
|
100 |
return plt.gcf()
|
101 |
|
102 |
inputs = [
|
103 |
-
|
104 |
-
gr.Audio(source = "microphone", label='Record audio from microphone', type="filepath")
|
105 |
]
|
106 |
|
107 |
-
examples = [
|
108 |
-
|
109 |
-
]
|
110 |
|
111 |
gr.Interface(
|
112 |
fn=predict,
|
|
|
81 |
pred = model.predict(audio_sample, batch_size=1, verbose=0)
|
82 |
return input, pred.squeeze(), sr
|
83 |
|
84 |
+
def predict(audio):
|
|
|
|
|
85 |
x, x_pred, sr = inference(audio, model)
|
86 |
fig, ax = plt.subplots(nrows=2, ncols=1, sharex=True, figsize=(10, 8), dpi=120)
|
87 |
D = librosa.amplitude_to_db(np.abs(librosa.stft(x)), ref=np.max)
|
|
|
98 |
return plt.gcf()
|
99 |
|
100 |
inputs = [
|
101 |
+
gr.Audio(source = "upload", label='Upload audio file', type="filepath"),
|
|
|
102 |
]
|
103 |
|
104 |
+
examples = ['sample_1.wav', 'sample_2.wav']
|
|
|
|
|
105 |
|
106 |
gr.Interface(
|
107 |
fn=predict,
|