Spaces:
Sleeping
Sleeping
deveix
commited on
Commit
·
9ba8cc6
1
Parent(s):
371eac7
fix main py
Browse files- app/main.py +7 -3
app/main.py
CHANGED
|
@@ -229,9 +229,13 @@ def extract_features(file_path):
|
|
| 229 |
# features = pd.concat([mfccs_mean, spectral_centroids, spectral_rolloff, spectral_flux, spectral_contrast, pitch_mean, zero_crossings])
|
| 230 |
|
| 231 |
features = smile.process_file(file_path)
|
| 232 |
-
|
| 233 |
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
|
| 236 |
|
| 237 |
@app.post("/mlp")
|
|
@@ -264,7 +268,7 @@ async def handle_audio(file: UploadFile = File(...)):
|
|
| 264 |
features = mlp_pca.transform(features)
|
| 265 |
|
| 266 |
# Dummy example to proceed with an inference
|
| 267 |
-
results = mlp_model.predict(
|
| 268 |
|
| 269 |
# Clean up (optional, especially if dealing with large files or sensitive data)
|
| 270 |
os.remove(temp_filename)
|
|
|
|
| 229 |
# features = pd.concat([mfccs_mean, spectral_centroids, spectral_rolloff, spectral_flux, spectral_contrast, pitch_mean, zero_crossings])
|
| 230 |
|
| 231 |
features = smile.process_file(file_path)
|
| 232 |
+
features_reshaped = features.squeeze()
|
| 233 |
|
| 234 |
+
# Ensure it's now a 2D structure suitable for DataFrame
|
| 235 |
+
print("New shape of features:", features_reshaped.shape)
|
| 236 |
+
|
| 237 |
+
all_data = pd.DataFrame([features_reshaped])
|
| 238 |
+
return all_data
|
| 239 |
|
| 240 |
|
| 241 |
@app.post("/mlp")
|
|
|
|
| 268 |
features = mlp_pca.transform(features)
|
| 269 |
|
| 270 |
# Dummy example to proceed with an inference
|
| 271 |
+
results = mlp_model.predict(features)
|
| 272 |
|
| 273 |
# Clean up (optional, especially if dealing with large files or sensitive data)
|
| 274 |
os.remove(temp_filename)
|