Spaces:
Running on Zero
Running on Zero
| # Enables postponed evaluation of type annotations for forward-compatible typing behavior | |
| from __future__ import annotations | |
| # Provides access to environment variables used to configure the application at runtime | |
| import os | |
| # defines the display title used by the ML app | |
| APP_TITLE = "Agentic Machine Learning" | |
| # reads the Hugging Face authentication token from the environment and removes surrounding whitespace | |
| HF_TOKEN = os.getenv("HF_TOKEN", "").strip() | |
| # selects the HF model ID while providing a default model when none is configured | |
| HF_MODEL_ID = os.getenv( | |
| "HF_MODEL_ID", | |
| "Qwen/Qwen3-Coder-30B-A3B-Instruct", | |
| ).strip() | |
| # selects the HF inference provider and falls back to automatic provider selection | |
| HF_PROVIDER = os.getenv("HF_PROVIDER", "auto").strip() or "auto" | |
| # sets the max allowed upload size in megabytes from an environment variable or default value | |
| MAX_UPLOAD_MB = int(os.getenv("MAX_UPLOAD_MB", "50")) | |
| # limits the number of rows used when profiling uploaded datasets | |
| MAX_PROFILE_ROWS = int(os.getenv("MAX_PROFILE_ROWS", "100000")) | |
| # limits the number of rows used during model training to control runtime and resource usage | |
| MAX_TRAIN_ROWS = int(os.getenv("MAX_TRAIN_ROWS", "25000")) | |
| # max number of tool-driven reasoning steps the agent may execute | |
| MAX_AGENT_STEPS = int(os.getenv("MAX_AGENT_STEPS", "4")) | |
| # default max number of tokens allowed in generated model responses | |
| DEFAULT_MAX_TOKENS = int(os.getenv("DEFAULT_MAX_TOKENS", "1800")) | |
| # deterministic random seed | |
| RANDOM_STATE = int(os.getenv("RANDOM_STATE", "42")) | |
| # Maximum ZeroGPU allocation for the decorated agent callback. | |
| # Hugging Face ZeroGPU defaults to 60 seconds; this project allows more time | |
| # because the agent can execute several bounded tool/inference steps. | |
| ZERO_GPU_DURATION = int(os.getenv("ZERO_GPU_DURATION", "120")) | |
| # lists the dataset file extensions accepted by the app | |
| SUPPORTED_DATA_EXTENSIONS = { | |
| ".csv", | |
| ".parquet", | |
| ".json", | |
| ".jsonl", | |
| ".xlsx", | |
| ".xls", | |
| } | |
| # HF repo containing the bundled example dataset | |
| EXAMPLE_DATASET_REPO = "scikit-learn/adult-census-income" | |
| # filename of the example dataset within the repo | |
| EXAMPLE_DATASET_FILE = "adult.csv" | |
| # target column used for the example ML modeling task | |
| EXAMPLE_DATASET_TARGET = "income" |