Spaces:
Runtime error
Runtime error
Reverting to default audio loading since librosa doesn't work yet.
Browse files- app.py +1 -1
- inference.py +3 -1
app.py
CHANGED
@@ -2,6 +2,6 @@ import gradio as gr
|
|
2 |
from inference import *
|
3 |
|
4 |
iface = gr.Interface(fn=inference,
|
5 |
-
inputs=gr.inputs.Audio(source="upload", type="filepath"),
|
6 |
outputs="text")
|
7 |
iface.launch(share=True)
|
|
|
2 |
from inference import *
|
3 |
|
4 |
iface = gr.Interface(fn=inference,
|
5 |
+
inputs='audio', #gr.inputs.Audio(source="upload", type="filepath"),
|
6 |
outputs="text")
|
7 |
iface.launch(share=True)
|
inference.py
CHANGED
@@ -12,9 +12,11 @@ def extract_mfcc_batch(file_path, n_mfcc=13, n_fft=1024, hop_length=512, length_
|
|
12 |
mfcc_batch = []
|
13 |
num_samples_per_segment = 220500 #length_segment * SAMPLE_RATE
|
14 |
|
15 |
-
|
|
|
16 |
|
17 |
duration = librosa.get_duration(y=signal, sr=sr) #30 seconds
|
|
|
18 |
num_segments = int(duration/length_segment) #3
|
19 |
# process segments, extracting mfccs and storing data
|
20 |
for s in range(num_segments+1):
|
|
|
12 |
mfcc_batch = []
|
13 |
num_samples_per_segment = 220500 #length_segment * SAMPLE_RATE
|
14 |
|
15 |
+
sr, signal = file_path#librosa.load(file_path, sr=SAMPLE_RATE)
|
16 |
+
signal = signal.astype(np.float64)
|
17 |
|
18 |
duration = librosa.get_duration(y=signal, sr=sr) #30 seconds
|
19 |
+
print(duration)
|
20 |
num_segments = int(duration/length_segment) #3
|
21 |
# process segments, extracting mfccs and storing data
|
22 |
for s in range(num_segments+1):
|