Spaces:
Runtime error
Runtime error
ikoghoemmanuell
commited on
Commit
•
bf559ea
1
Parent(s):
3a5f329
Update app/main.py
Browse files- app/main.py +3 -1
app/main.py
CHANGED
@@ -24,6 +24,8 @@ def predict(df, endpoint="simple"):
|
|
24 |
|
25 |
response = []
|
26 |
for eta in prediction:
|
|
|
|
|
27 |
# Create a response for each prediction with the predicted ETA
|
28 |
output = {
|
29 |
"predicted_eta": eta
|
@@ -74,7 +76,7 @@ def predict_eta(trip: Trip):
|
|
74 |
# Make prediction
|
75 |
data = pd.DataFrame(trip.dict(), index=[0])
|
76 |
predicted_eta = predict(df=data)
|
77 |
-
return
|
78 |
|
79 |
# Multiple Prediction Endpoint
|
80 |
@app.post("/predict_multiple")
|
|
|
24 |
|
25 |
response = []
|
26 |
for eta in prediction:
|
27 |
+
# Convert NumPy float to Python native float
|
28 |
+
eta = float(eta)
|
29 |
# Create a response for each prediction with the predicted ETA
|
30 |
output = {
|
31 |
"predicted_eta": eta
|
|
|
76 |
# Make prediction
|
77 |
data = pd.DataFrame(trip.dict(), index=[0])
|
78 |
predicted_eta = predict(df=data)
|
79 |
+
return predicted_eta
|
80 |
|
81 |
# Multiple Prediction Endpoint
|
82 |
@app.post("/predict_multiple")
|