Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,13 +14,17 @@ model_columns = joblib.load(columns_path)
|
|
| 14 |
# Prediction function
|
| 15 |
def predict_player(player: dict):
|
| 16 |
try:
|
|
|
|
| 17 |
df = pd.DataFrame([player])
|
| 18 |
-
df = df[model_columns]
|
| 19 |
prediction = model.predict(df)
|
| 20 |
-
|
|
|
|
| 21 |
except Exception as e:
|
|
|
|
| 22 |
return {"error": str(e)}
|
| 23 |
|
|
|
|
| 24 |
# Gradio Interface
|
| 25 |
iface = gr.Interface(
|
| 26 |
fn=predict_player,
|
|
|
|
| 14 |
# Prediction function
|
| 15 |
def predict_player(player: dict):
|
| 16 |
try:
|
| 17 |
+
print("Received:", player) # <--- log input
|
| 18 |
df = pd.DataFrame([player])
|
| 19 |
+
df = df[model_columns]
|
| 20 |
prediction = model.predict(df)
|
| 21 |
+
print("Prediction:", prediction) # <--- log output
|
| 22 |
+
return float(prediction[0])
|
| 23 |
except Exception as e:
|
| 24 |
+
print("Error:", e) # <--- log errors
|
| 25 |
return {"error": str(e)}
|
| 26 |
|
| 27 |
+
|
| 28 |
# Gradio Interface
|
| 29 |
iface = gr.Interface(
|
| 30 |
fn=predict_player,
|