diff --git a/app.py b/app.py new file mode 100644 index 0000000000000000000000000000000000000000..c96e395e1d5175b85288b888a527fbc9fe12b828 --- /dev/null +++ b/app.py @@ -0,0 +1,19 @@ +import sys +import os +from pathlib import Path + +# Add backend to sys.path so we can import modules correctly +# We add both backend/ and backend/code to the path +backend_path = Path(__file__).parent / "backend" +sys.path.append(str(backend_path)) +sys.path.append(str(backend_path / "code")) + +# Import the FastAPI app from main.py in the backend folder +from main import app + +# For Hugging Face Spaces, the file must be named app.py or main.py +# and the app instance must be called 'app'. +if __name__ == "__main__": + import uvicorn + port = int(os.environ.get("PORT", 7860)) + uvicorn.run(app, host="0.0.0.0", port=port) diff --git a/backend/.env.example b/matrix/.env.example similarity index 100% rename from backend/.env.example rename to matrix/.env.example diff --git a/backend/Dockerfile b/matrix/Dockerfile similarity index 100% rename from backend/Dockerfile rename to matrix/Dockerfile diff --git a/backend/benchmark.py b/matrix/benchmark.py similarity index 99% rename from backend/benchmark.py rename to matrix/benchmark.py index 0d9dde4e4d7bbe9552e13a7a3e5d1a73a89b6bfb..0835da305fbc4b5b3230e2e3662b50f9eaf13019 100644 --- a/backend/benchmark.py +++ b/matrix/benchmark.py @@ -17,7 +17,7 @@ from sklearn.neighbors import KNeighborsClassifier, KNeighborsRegressor warnings.filterwarnings("ignore") # Allow importing model wrappers from the code directory -sys.path.insert(0, str(Path(__file__).parent.parent / "code")) +sys.path.insert(0, str(Path(__file__).parent / "code")) N_FOLDS = int(os.getenv("N_FOLDS", "5")) RAND = int(os.getenv("RANDOM_STATE", "42")) diff --git a/backend/catboost_info/catboost_training.json b/matrix/catboost_info/catboost_training.json similarity index 100% rename from backend/catboost_info/catboost_training.json rename to matrix/catboost_info/catboost_training.json diff --git a/backend/catboost_info/learn/events.out.tfevents b/matrix/catboost_info/learn/events.out.tfevents similarity index 100% rename from backend/catboost_info/learn/events.out.tfevents rename to matrix/catboost_info/learn/events.out.tfevents diff --git a/backend/catboost_info/learn_error.tsv b/matrix/catboost_info/learn_error.tsv similarity index 100% rename from backend/catboost_info/learn_error.tsv rename to matrix/catboost_info/learn_error.tsv diff --git a/backend/catboost_info/time_left.tsv b/matrix/catboost_info/time_left.tsv similarity index 100% rename from backend/catboost_info/time_left.tsv rename to matrix/catboost_info/time_left.tsv diff --git a/backend/code/analysis/__init__.py b/matrix/code/analysis/__init__.py similarity index 100% rename from backend/code/analysis/__init__.py rename to matrix/code/analysis/__init__.py diff --git a/backend/code/analysis/aggregate_results.py b/matrix/code/analysis/aggregate_results.py similarity index 100% rename from backend/code/analysis/aggregate_results.py rename to matrix/code/analysis/aggregate_results.py diff --git a/backend/code/config/datasets.yaml b/matrix/code/config/datasets.yaml similarity index 100% rename from backend/code/config/datasets.yaml rename to matrix/code/config/datasets.yaml diff --git a/backend/code/config/experiments.yaml b/matrix/code/config/experiments.yaml similarity index 100% rename from backend/code/config/experiments.yaml rename to matrix/code/config/experiments.yaml diff --git a/backend/code/config/models.yaml b/matrix/code/config/models.yaml similarity index 100% rename from backend/code/config/models.yaml rename to matrix/code/config/models.yaml diff --git a/backend/code/docker/Dockerfile b/matrix/code/docker/Dockerfile similarity index 100% rename from backend/code/docker/Dockerfile rename to matrix/code/docker/Dockerfile diff --git a/backend/code/evaluation/__init__.py b/matrix/code/evaluation/__init__.py similarity index 100% rename from backend/code/evaluation/__init__.py rename to matrix/code/evaluation/__init__.py diff --git a/backend/code/evaluation/compute_tracker.py b/matrix/code/evaluation/compute_tracker.py similarity index 100% rename from backend/code/evaluation/compute_tracker.py rename to matrix/code/evaluation/compute_tracker.py diff --git a/backend/code/evaluation/cross_validation.py b/matrix/code/evaluation/cross_validation.py similarity index 100% rename from backend/code/evaluation/cross_validation.py rename to matrix/code/evaluation/cross_validation.py diff --git a/backend/code/evaluation/metrics.py b/matrix/code/evaluation/metrics.py similarity index 100% rename from backend/code/evaluation/metrics.py rename to matrix/code/evaluation/metrics.py diff --git a/backend/code/evaluation/statistical_tests.py b/matrix/code/evaluation/statistical_tests.py similarity index 100% rename from backend/code/evaluation/statistical_tests.py rename to matrix/code/evaluation/statistical_tests.py diff --git a/backend/code/models/__init__.py b/matrix/code/models/__init__.py similarity index 100% rename from backend/code/models/__init__.py rename to matrix/code/models/__init__.py diff --git a/backend/code/models/autogluon_wrapper.py b/matrix/code/models/autogluon_wrapper.py similarity index 100% rename from backend/code/models/autogluon_wrapper.py rename to matrix/code/models/autogluon_wrapper.py diff --git a/backend/code/models/base_wrapper.py b/matrix/code/models/base_wrapper.py similarity index 100% rename from backend/code/models/base_wrapper.py rename to matrix/code/models/base_wrapper.py diff --git a/backend/code/models/baseline_wrappers.py b/matrix/code/models/baseline_wrappers.py similarity index 100% rename from backend/code/models/baseline_wrappers.py rename to matrix/code/models/baseline_wrappers.py diff --git a/backend/code/models/sap_rpt1_hf_wrapper.py b/matrix/code/models/sap_rpt1_hf_wrapper.py similarity index 100% rename from backend/code/models/sap_rpt1_hf_wrapper.py rename to matrix/code/models/sap_rpt1_hf_wrapper.py diff --git a/backend/code/models/sap_rpt1_wrapper.py b/matrix/code/models/sap_rpt1_wrapper.py similarity index 100% rename from backend/code/models/sap_rpt1_wrapper.py rename to matrix/code/models/sap_rpt1_wrapper.py diff --git a/backend/code/models/tabicl_wrapper.py b/matrix/code/models/tabicl_wrapper.py similarity index 100% rename from backend/code/models/tabicl_wrapper.py rename to matrix/code/models/tabicl_wrapper.py diff --git a/backend/code/models/tabpfn_wrapper.py b/matrix/code/models/tabpfn_wrapper.py similarity index 100% rename from backend/code/models/tabpfn_wrapper.py rename to matrix/code/models/tabpfn_wrapper.py diff --git a/backend/code/runners/__init__.py b/matrix/code/runners/__init__.py similarity index 100% rename from backend/code/runners/__init__.py rename to matrix/code/runners/__init__.py diff --git a/backend/code/runners/run_baselines.py b/matrix/code/runners/run_baselines.py similarity index 100% rename from backend/code/runners/run_baselines.py rename to matrix/code/runners/run_baselines.py diff --git a/backend/code/runners/run_batch.py b/matrix/code/runners/run_batch.py similarity index 100% rename from backend/code/runners/run_batch.py rename to matrix/code/runners/run_batch.py diff --git a/backend/code/runners/run_experiment.py b/matrix/code/runners/run_experiment.py similarity index 100% rename from backend/code/runners/run_experiment.py rename to matrix/code/runners/run_experiment.py diff --git a/backend/code/sap_rpt1.egg-info/PKG-INFO b/matrix/code/sap_rpt1.egg-info/PKG-INFO similarity index 100% rename from backend/code/sap_rpt1.egg-info/PKG-INFO rename to matrix/code/sap_rpt1.egg-info/PKG-INFO diff --git a/backend/code/sap_rpt1.egg-info/SOURCES.txt b/matrix/code/sap_rpt1.egg-info/SOURCES.txt similarity index 100% rename from backend/code/sap_rpt1.egg-info/SOURCES.txt rename to matrix/code/sap_rpt1.egg-info/SOURCES.txt diff --git a/backend/code/sap_rpt1.egg-info/dependency_links.txt b/matrix/code/sap_rpt1.egg-info/dependency_links.txt similarity index 100% rename from backend/code/sap_rpt1.egg-info/dependency_links.txt rename to matrix/code/sap_rpt1.egg-info/dependency_links.txt diff --git a/backend/code/sap_rpt1.egg-info/requires.txt b/matrix/code/sap_rpt1.egg-info/requires.txt similarity index 100% rename from backend/code/sap_rpt1.egg-info/requires.txt rename to matrix/code/sap_rpt1.egg-info/requires.txt diff --git a/backend/code/sap_rpt1.egg-info/top_level.txt b/matrix/code/sap_rpt1.egg-info/top_level.txt similarity index 100% rename from backend/code/sap_rpt1.egg-info/top_level.txt rename to matrix/code/sap_rpt1.egg-info/top_level.txt diff --git a/backend/code/utils/__init__.py b/matrix/code/utils/__init__.py similarity index 100% rename from backend/code/utils/__init__.py rename to matrix/code/utils/__init__.py diff --git a/backend/code/utils/logging_utils.py b/matrix/code/utils/logging_utils.py similarity index 100% rename from backend/code/utils/logging_utils.py rename to matrix/code/utils/logging_utils.py diff --git a/backend/ensemble.py b/matrix/ensemble.py similarity index 100% rename from backend/ensemble.py rename to matrix/ensemble.py diff --git a/backend/fix_dataset.py b/matrix/fix_dataset.py similarity index 100% rename from backend/fix_dataset.py rename to matrix/fix_dataset.py diff --git a/main.py b/matrix/main.py similarity index 99% rename from main.py rename to matrix/main.py index 0d3c2fdcd4721d721ce8e37735bdbd1a72f75be0..ad8d35907b983c185ee61b1d1afccfd1b8ac72c3 100644 --- a/main.py +++ b/matrix/main.py @@ -7,7 +7,9 @@ from pathlib import Path from dotenv import load_dotenv # Load .env before anything else so HF_TOKEN is available to benchmark.py +# Load .env from current or parent directory load_dotenv(Path(__file__).parent / ".env") +load_dotenv(Path(__file__).parent.parent / ".env") import pandas as pd from fastapi import FastAPI, File, UploadFile, Form, HTTPException diff --git a/backend/scripts/demo_benchmark.py b/matrix/scripts/demo_benchmark.py similarity index 100% rename from backend/scripts/demo_benchmark.py rename to matrix/scripts/demo_benchmark.py diff --git a/backend/scripts/download_datasets.py b/matrix/scripts/download_datasets.py similarity index 100% rename from backend/scripts/download_datasets.py rename to matrix/scripts/download_datasets.py diff --git a/backend/scripts/reproduce_all.sh b/matrix/scripts/reproduce_all.sh similarity index 100% rename from backend/scripts/reproduce_all.sh rename to matrix/scripts/reproduce_all.sh diff --git a/backend/scripts/test_sap_rpt1.py b/matrix/scripts/test_sap_rpt1.py similarity index 100% rename from backend/scripts/test_sap_rpt1.py rename to matrix/scripts/test_sap_rpt1.py diff --git a/backend/setup.py b/matrix/setup.py similarity index 100% rename from backend/setup.py rename to matrix/setup.py diff --git a/backend/static/app.js b/matrix/static/app.js similarity index 100% rename from backend/static/app.js rename to matrix/static/app.js diff --git a/backend/static/arena.html b/matrix/static/arena.html similarity index 100% rename from backend/static/arena.html rename to matrix/static/arena.html diff --git a/backend/static/landing.html b/matrix/static/landing.html similarity index 100% rename from backend/static/landing.html rename to matrix/static/landing.html diff --git a/backend/static/style.css b/matrix/static/style.css similarity index 100% rename from backend/static/style.css rename to matrix/static/style.css diff --git a/backend/static/uploader.html b/matrix/static/uploader.html similarity index 100% rename from backend/static/uploader.html rename to matrix/static/uploader.html diff --git a/requirements.txt b/requirements.txt index ff84d904619053c7e7ad8e8ba9de84ce05d31c26..3bc35890a224ca6b1e884c55702fabdf51347425 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,28 +1,29 @@ -# ============================================================================= -# Pinned Dependencies for Reproducibility -# ============================================================================= -# All versions are pinned to ensure identical results across machines. -# To update: pip install --upgrade, then update version here. -# ============================================================================= +# Core Backend & API +fastapi>=0.110.0 +uvicorn[standard]>=0.29.0 +python-multipart>=0.0.9 +python-dotenv>=1.0.0 +jinja2>=3.1.3 -# Core scientific stack +# Data & Science Stack numpy==1.26.4 pandas==2.2.3 scikit-learn==1.6.1 scipy==1.14.1 matplotlib==3.9.2 seaborn==0.13.2 - -# Configuration & utilities pyyaml==6.0.2 tqdm==4.67.1 joblib==1.4.2 -python-dotenv==1.0.1 psutil==6.1.1 - -# Data sources openml==0.14.2 +# Machine Learning Models +xgboost>=2.0.0 +lightgbm>=4.0.0 +catboost>=1.2.0 +tabpfn==0.1.11 + # PyTorch & Hugging Face (for SAP RPT-1 OSS) --extra-index-url https://download.pytorch.org/whl/cpu torch==2.7.0+cpu @@ -33,6 +34,5 @@ datasets==3.5.0 pyarrow==20.0.0 torcheval==0.0.7 -# SAP RPT-1 OSS model (pinned to release v1.1.2) +# SAP RPT-1 OSS model sap-rpt-oss @ git+https://github.com/SAP-samples/sap-rpt-1-oss.git@v1.1.2 -