Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -69,13 +69,13 @@ async def predict_student_performance_api(req: form2):
|
|
| 69 |
input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)
|
| 70 |
|
| 71 |
# Perform the prediction
|
| 72 |
-
prediction = model_ML_DiabetesPrediction.predict(input_data_reshaped)
|
|
|
|
| 73 |
|
| 74 |
-
return JSONResponse(content={"ok": 1, "prediction": prediction
|
| 75 |
except Exception as e:
|
| 76 |
return JSONResponse(content={"ok": -1, "message": f"Something went wrong! {str(e)}"}, status_code=500)
|
| 77 |
|
| 78 |
-
|
| 79 |
# Main function to run the FastAPI server
|
| 80 |
if __name__ == "__main__":
|
| 81 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
| 69 |
input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)
|
| 70 |
|
| 71 |
# Perform the prediction
|
| 72 |
+
prediction = model_ML_DiabetesPrediction.predict(input_data_reshaped)[0]
|
| 73 |
+
prediction = int(prediction)
|
| 74 |
|
| 75 |
+
return JSONResponse(content={"ok": 1, "prediction": prediction})
|
| 76 |
except Exception as e:
|
| 77 |
return JSONResponse(content={"ok": -1, "message": f"Something went wrong! {str(e)}"}, status_code=500)
|
| 78 |
|
|
|
|
| 79 |
# Main function to run the FastAPI server
|
| 80 |
if __name__ == "__main__":
|
| 81 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|