Spaces:
Running
Running
deveix
commited on
Commit
·
a1e6e83
1
Parent(s):
0aa7816
try to fix output
Browse files- app/main.py +5 -4
app/main.py
CHANGED
@@ -269,15 +269,16 @@ async def handle_audio(file: UploadFile = File(...)):
|
|
269 |
|
270 |
# proceed with an inference
|
271 |
results = mlp_model.predict(features)
|
|
|
272 |
|
273 |
-
# Decode the predictions using the label encoder
|
274 |
-
decoded_predictions = mlp_label_encoder.inverse_transform(results)
|
275 |
-
|
276 |
# Clean up the temporary file
|
277 |
os.remove(temp_filename)
|
278 |
|
279 |
# Return a successful response with decoded predictions
|
280 |
-
return {"message": "File processed successfully", "prediction": decoded_predictions
|
281 |
except Exception as e:
|
282 |
# Handle possible exceptions
|
283 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
269 |
|
270 |
# proceed with an inference
|
271 |
results = mlp_model.predict(features)
|
272 |
+
decoded_predictions = [mlp_label_encoder.classes_[i] for i in results]
|
273 |
|
274 |
+
# # Decode the predictions using the label encoder
|
275 |
+
# decoded_predictions = mlp_label_encoder.inverse_transform(results)
|
276 |
+
# .tolist()
|
277 |
# Clean up the temporary file
|
278 |
os.remove(temp_filename)
|
279 |
|
280 |
# Return a successful response with decoded predictions
|
281 |
+
return {"message": "File processed successfully", "prediction": decoded_predictions}
|
282 |
except Exception as e:
|
283 |
# Handle possible exceptions
|
284 |
raise HTTPException(status_code=500, detail=str(e))
|