Spaces:
Running
Running
deveix
commited on
Commit
·
bbbeb15
1
Parent(s):
5107b4c
fix reshape
Browse files- app/main.py +5 -4
app/main.py
CHANGED
@@ -324,7 +324,7 @@ async def handle_audio(file: UploadFile = File(...)):
|
|
324 |
audio_data, sr = preprocess_audio(audio_data, sr)
|
325 |
print("finished processing ", temp_filename)
|
326 |
# Extract features
|
327 |
-
features = extract_features(audio_data, sr)
|
328 |
|
329 |
# preprocess_audio(temp_filename, 'app')
|
330 |
# repair_mp3_with_ffmpeg_python(temp_filename, temp_filename)
|
@@ -332,12 +332,13 @@ async def handle_audio(file: UploadFile = File(...)):
|
|
332 |
# features = extract_features(temp_filename)
|
333 |
print("Extracted Features:", features)
|
334 |
# features = pca.transform(features)
|
335 |
-
features = np.array(features)
|
336 |
-
|
|
|
337 |
features = scaler.transform(features)
|
338 |
|
339 |
# proceed with an inference
|
340 |
-
results = model.predict(
|
341 |
# decoded_predictions = [label_encoder.classes_[i] for i in results]
|
342 |
|
343 |
# # Decode the predictions using the label encoder
|
|
|
324 |
audio_data, sr = preprocess_audio(audio_data, sr)
|
325 |
print("finished processing ", temp_filename)
|
326 |
# Extract features
|
327 |
+
features = extract_features(audio_data, sr)
|
328 |
|
329 |
# preprocess_audio(temp_filename, 'app')
|
330 |
# repair_mp3_with_ffmpeg_python(temp_filename, temp_filename)
|
|
|
332 |
# features = extract_features(temp_filename)
|
333 |
print("Extracted Features:", features)
|
334 |
# features = pca.transform(features)
|
335 |
+
# features = np.array(features).reshape(1, -1)
|
336 |
+
features = features.reshape(1, -1)
|
337 |
+
|
338 |
features = scaler.transform(features)
|
339 |
|
340 |
# proceed with an inference
|
341 |
+
results = model.predict(features)
|
342 |
# decoded_predictions = [label_encoder.classes_[i] for i in results]
|
343 |
|
344 |
# # Decode the predictions using the label encoder
|