Spaces:
Sleeping
Sleeping
Commit ·
4f499c4
1
Parent(s): 30593bd
fix: handle webapp.benchmark module path in Docker container
Browse files- webapp/main.py +8 -2
webapp/main.py
CHANGED
|
@@ -180,7 +180,10 @@ async def benchmark(
|
|
| 180 |
|
| 181 |
# Cache the Best Overall model for the Live Playground
|
| 182 |
best_name = result["recommendation"]["recommendations"]["best_overall"]["model"]
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
| 184 |
X = df.drop(columns=[target_col])
|
| 185 |
y_raw = df[target_col]
|
| 186 |
task = result["dataset_info"]["task"]
|
|
@@ -234,7 +237,10 @@ async def predict(data: dict):
|
|
| 234 |
# Ensure column order matches training
|
| 235 |
input_df = input_df[CHAMPION_INFO["features"]]
|
| 236 |
|
| 237 |
-
|
|
|
|
|
|
|
|
|
|
| 238 |
# Use the EXACT same encoders that were used during training
|
| 239 |
X_test, _ = _prep(input_df, encoders=CHAMPION_INFO.get("encoders"))
|
| 240 |
|
|
|
|
| 180 |
|
| 181 |
# Cache the Best Overall model for the Live Playground
|
| 182 |
best_name = result["recommendation"]["recommendations"]["best_overall"]["model"]
|
| 183 |
+
try:
|
| 184 |
+
from benchmark import BUILDERS, _prep, _encode_target
|
| 185 |
+
except ImportError:
|
| 186 |
+
from webapp.benchmark import BUILDERS, _prep, _encode_target
|
| 187 |
X = df.drop(columns=[target_col])
|
| 188 |
y_raw = df[target_col]
|
| 189 |
task = result["dataset_info"]["task"]
|
|
|
|
| 237 |
# Ensure column order matches training
|
| 238 |
input_df = input_df[CHAMPION_INFO["features"]]
|
| 239 |
|
| 240 |
+
try:
|
| 241 |
+
from benchmark import _prep
|
| 242 |
+
except ImportError:
|
| 243 |
+
from webapp.benchmark import _prep
|
| 244 |
# Use the EXACT same encoders that were used during training
|
| 245 |
X_test, _ = _prep(input_df, encoders=CHAMPION_INFO.get("encoders"))
|
| 246 |
|