Spaces:
Sleeping
Sleeping
Commit ·
ea7bee1
1
Parent(s): f1435ee
fix: restore local execution compatibility and fix setup.py package mapping
Browse files- setup.py +2 -2
- webapp/benchmark.py +7 -4
- webapp/main.py +5 -2
setup.py
CHANGED
|
@@ -3,8 +3,8 @@ from setuptools import setup, find_packages
|
|
| 3 |
setup(
|
| 4 |
name="sap-rpt1",
|
| 5 |
version="0.1.0",
|
| 6 |
-
package_dir={"": "
|
| 7 |
-
packages=find_packages(where="
|
| 8 |
install_requires=[
|
| 9 |
"numpy>=1.26.4",
|
| 10 |
"pandas>=2.2.3",
|
|
|
|
| 3 |
setup(
|
| 4 |
name="sap-rpt1",
|
| 5 |
version="0.1.0",
|
| 6 |
+
package_dir={"": "webapp"},
|
| 7 |
+
packages=find_packages(where="webapp"),
|
| 8 |
install_requires=[
|
| 9 |
"numpy>=1.26.4",
|
| 10 |
"pandas>=2.2.3",
|
webapp/benchmark.py
CHANGED
|
@@ -24,8 +24,11 @@ os.environ.setdefault("TABPFN_ACCEPT_TERMS", "1")
|
|
| 24 |
os.environ.setdefault("TABPFN_LICENSE_ACCEPTED", "1")
|
| 25 |
os.environ.setdefault("AGREE_TABPFN_LICENSE", "1")
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
N_FOLDS = int(os.getenv("N_FOLDS", "3"))
|
| 31 |
RAND = int(os.getenv("RANDOM_STATE", "42"))
|
|
@@ -437,9 +440,9 @@ def run_benchmark(df: pd.DataFrame, target_col: str) -> dict:
|
|
| 437 |
dict with keys: dataset_info, task, results, ensemble_info, recommendation
|
| 438 |
"""
|
| 439 |
try:
|
| 440 |
-
from ensemble import select_top_models, run_voting_ensemble, run_stacking_ensemble, SKLEARN_SAFE
|
| 441 |
-
except ImportError:
|
| 442 |
from webapp.ensemble import select_top_models, run_voting_ensemble, run_stacking_ensemble, SKLEARN_SAFE
|
|
|
|
|
|
|
| 443 |
|
| 444 |
y_raw = df[target_col].copy()
|
| 445 |
X = df.drop(columns=[target_col]).copy()
|
|
|
|
| 24 |
os.environ.setdefault("TABPFN_LICENSE_ACCEPTED", "1")
|
| 25 |
os.environ.setdefault("AGREE_TABPFN_LICENSE", "1")
|
| 26 |
|
| 27 |
+
# Flexible imports to support both HF Space (root) and local execution (inside webapp)
|
| 28 |
+
try:
|
| 29 |
+
from webapp.models.tabpfn_wrapper import TabPFNWrapper
|
| 30 |
+
except (ImportError, ModuleNotFoundError):
|
| 31 |
+
from models.tabpfn_wrapper import TabPFNWrapper
|
| 32 |
|
| 33 |
N_FOLDS = int(os.getenv("N_FOLDS", "3"))
|
| 34 |
RAND = int(os.getenv("RANDOM_STATE", "42"))
|
|
|
|
| 440 |
dict with keys: dataset_info, task, results, ensemble_info, recommendation
|
| 441 |
"""
|
| 442 |
try:
|
|
|
|
|
|
|
| 443 |
from webapp.ensemble import select_top_models, run_voting_ensemble, run_stacking_ensemble, SKLEARN_SAFE
|
| 444 |
+
except (ImportError, ModuleNotFoundError):
|
| 445 |
+
from ensemble import select_top_models, run_voting_ensemble, run_stacking_ensemble, SKLEARN_SAFE
|
| 446 |
|
| 447 |
y_raw = df[target_col].copy()
|
| 448 |
X = df.drop(columns=[target_col]).copy()
|
webapp/main.py
CHANGED
|
@@ -9,8 +9,11 @@ from fastapi import FastAPI, File, UploadFile, Form, HTTPException
|
|
| 9 |
from fastapi.responses import JSONResponse, FileResponse
|
| 10 |
from fastapi.staticfiles import StaticFiles
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Setup logging
|
| 16 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 9 |
from fastapi.responses import JSONResponse, FileResponse
|
| 10 |
from fastapi.staticfiles import StaticFiles
|
| 11 |
|
| 12 |
+
# Flexible imports to support both HF Space (root) and local execution (inside webapp)
|
| 13 |
+
try:
|
| 14 |
+
from webapp.benchmark import run_benchmark, infer_task, BUILDERS, _prep, _encode_target
|
| 15 |
+
except (ImportError, ModuleNotFoundError):
|
| 16 |
+
from benchmark import run_benchmark, infer_task, BUILDERS, _prep, _encode_target
|
| 17 |
|
| 18 |
# Setup logging
|
| 19 |
logging.basicConfig(level=logging.INFO)
|