Spaces:
Running
Running
deveix
commited on
Commit
·
ee4841d
1
Parent(s):
6550579
fix cnn
Browse files- app/main.py +2 -2
app/main.py
CHANGED
@@ -212,7 +212,7 @@ SAMPLE_RATE = 44100 # sample rate to use
|
|
212 |
N_MELS = 128 # number of Mel bands to generate
|
213 |
HOP_LENGTH = 512 # number of samples between successive frames
|
214 |
|
215 |
-
def
|
216 |
try:
|
217 |
# Load the audio file
|
218 |
audio, sr = librosa.load(file_path, sr=SAMPLE_RATE)
|
@@ -289,7 +289,7 @@ async def handle_cnn(file: UploadFile = File(...)):
|
|
289 |
|
290 |
spectrograms = []
|
291 |
|
292 |
-
clips =
|
293 |
for clip in clips:
|
294 |
spectrogram = generate_spectrogram(clip)
|
295 |
if np.isnan(spectrogram).any() or np.isinf(spectrogram).any():
|
|
|
212 |
N_MELS = 128 # number of Mel bands to generate
|
213 |
HOP_LENGTH = 512 # number of samples between successive frames
|
214 |
|
215 |
+
def preprocess_audio_cnn(file_path):
|
216 |
try:
|
217 |
# Load the audio file
|
218 |
audio, sr = librosa.load(file_path, sr=SAMPLE_RATE)
|
|
|
289 |
|
290 |
spectrograms = []
|
291 |
|
292 |
+
clips = preprocess_audio_cnn(temp_filename)
|
293 |
for clip in clips:
|
294 |
spectrogram = generate_spectrogram(clip)
|
295 |
if np.isnan(spectrogram).any() or np.isinf(spectrogram).any():
|