Luis
commited on
Commit
•
3716f01
1
Parent(s):
9e91c7d
add lib audio2numpy
Browse files- app.py +3 -2
- requirements.txt +1 -1
app.py
CHANGED
@@ -12,11 +12,12 @@ from scipy.io import wavfile
|
|
12 |
import scipy
|
13 |
|
14 |
# import soundfile as sf
|
|
|
15 |
import os
|
16 |
|
17 |
import gradio as gr
|
18 |
|
19 |
-
import
|
20 |
# import numpy as np
|
21 |
|
22 |
|
@@ -85,7 +86,7 @@ def inference(audio):
|
|
85 |
if debug: print(f'read, wav_file_name: {wav_file_name}')
|
86 |
|
87 |
if wav_file_name.endswith('.mp3'):
|
88 |
-
|
89 |
else:
|
90 |
sample_rate, wav_data = wavfile.read(wav_file_name, 'rb')
|
91 |
|
|
|
12 |
import scipy
|
13 |
|
14 |
# import soundfile as sf
|
15 |
+
import audio2numpy as a2n
|
16 |
import os
|
17 |
|
18 |
import gradio as gr
|
19 |
|
20 |
+
import audio2numpy
|
21 |
# import numpy as np
|
22 |
|
23 |
|
|
|
86 |
if debug: print(f'read, wav_file_name: {wav_file_name}')
|
87 |
|
88 |
if wav_file_name.endswith('.mp3'):
|
89 |
+
wav_data, sample_rate = a2n.audio_from_file(wav_file_name)
|
90 |
else:
|
91 |
sample_rate, wav_data = wavfile.read(wav_file_name, 'rb')
|
92 |
|
requirements.txt
CHANGED
@@ -3,4 +3,4 @@ tensorflow_hub
|
|
3 |
numpy
|
4 |
scipy
|
5 |
gradio
|
6 |
-
|
|
|
3 |
numpy
|
4 |
scipy
|
5 |
gradio
|
6 |
+
audio2numpy
|