Spaces:
Running on Zero
Running on Zero
Update config.py
Browse files
config.py
CHANGED
|
@@ -1,36 +1,62 @@
|
|
| 1 |
-
#
|
| 2 |
from __future__ import annotations
|
|
|
|
| 3 |
# Provides access to environment variables used to configure the application at runtime
|
| 4 |
import os
|
| 5 |
|
| 6 |
# defines the display title used by the ML app
|
| 7 |
APP_TITLE = "Agentic Machine Learning"
|
|
|
|
| 8 |
# reads the Hugging Face authentication token from the environment and removes surrounding whitespace
|
| 9 |
HF_TOKEN = os.getenv("HF_TOKEN", "").strip()
|
|
|
|
| 10 |
# selects the HF model ID while providing a default model when none is configured
|
| 11 |
-
HF_MODEL_ID = os.getenv(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# selects the HF inference provider and falls back to automatic provider selection
|
| 13 |
HF_PROVIDER = os.getenv("HF_PROVIDER", "auto").strip() or "auto"
|
| 14 |
|
| 15 |
# sets the max allowed upload size in megabytes from an environment variable or default value
|
| 16 |
MAX_UPLOAD_MB = int(os.getenv("MAX_UPLOAD_MB", "50"))
|
|
|
|
| 17 |
# limits the number of rows used when profiling uploaded datasets
|
| 18 |
MAX_PROFILE_ROWS = int(os.getenv("MAX_PROFILE_ROWS", "100000"))
|
|
|
|
| 19 |
# limits the number of rows used during model training to control runtime and resource usage
|
| 20 |
MAX_TRAIN_ROWS = int(os.getenv("MAX_TRAIN_ROWS", "25000"))
|
|
|
|
| 21 |
# max number of tool-driven reasoning steps the agent may execute
|
| 22 |
MAX_AGENT_STEPS = int(os.getenv("MAX_AGENT_STEPS", "4"))
|
|
|
|
| 23 |
# default max number of tokens allowed in generated model responses
|
| 24 |
DEFAULT_MAX_TOKENS = int(os.getenv("DEFAULT_MAX_TOKENS", "1800"))
|
|
|
|
| 25 |
# deterministic random seed
|
| 26 |
RANDOM_STATE = int(os.getenv("RANDOM_STATE", "42"))
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# lists the dataset file extensions accepted by the app
|
| 29 |
-
SUPPORTED_DATA_EXTENSIONS = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# HF repo containing the bundled example dataset
|
| 32 |
EXAMPLE_DATASET_REPO = "scikit-learn/adult-census-income"
|
|
|
|
| 33 |
# filename of the example dataset within the repo
|
| 34 |
EXAMPLE_DATASET_FILE = "adult.csv"
|
|
|
|
| 35 |
# target column used for the example ML modeling task
|
| 36 |
-
EXAMPLE_DATASET_TARGET = "income"
|
|
|
|
| 1 |
+
# Enables postponed evaluation of type annotations for forward-compatible typing behavior
|
| 2 |
from __future__ import annotations
|
| 3 |
+
|
| 4 |
# Provides access to environment variables used to configure the application at runtime
|
| 5 |
import os
|
| 6 |
|
| 7 |
# defines the display title used by the ML app
|
| 8 |
APP_TITLE = "Agentic Machine Learning"
|
| 9 |
+
|
| 10 |
# reads the Hugging Face authentication token from the environment and removes surrounding whitespace
|
| 11 |
HF_TOKEN = os.getenv("HF_TOKEN", "").strip()
|
| 12 |
+
|
| 13 |
# selects the HF model ID while providing a default model when none is configured
|
| 14 |
+
HF_MODEL_ID = os.getenv(
|
| 15 |
+
"HF_MODEL_ID",
|
| 16 |
+
"Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
| 17 |
+
).strip()
|
| 18 |
+
|
| 19 |
# selects the HF inference provider and falls back to automatic provider selection
|
| 20 |
HF_PROVIDER = os.getenv("HF_PROVIDER", "auto").strip() or "auto"
|
| 21 |
|
| 22 |
# sets the max allowed upload size in megabytes from an environment variable or default value
|
| 23 |
MAX_UPLOAD_MB = int(os.getenv("MAX_UPLOAD_MB", "50"))
|
| 24 |
+
|
| 25 |
# limits the number of rows used when profiling uploaded datasets
|
| 26 |
MAX_PROFILE_ROWS = int(os.getenv("MAX_PROFILE_ROWS", "100000"))
|
| 27 |
+
|
| 28 |
# limits the number of rows used during model training to control runtime and resource usage
|
| 29 |
MAX_TRAIN_ROWS = int(os.getenv("MAX_TRAIN_ROWS", "25000"))
|
| 30 |
+
|
| 31 |
# max number of tool-driven reasoning steps the agent may execute
|
| 32 |
MAX_AGENT_STEPS = int(os.getenv("MAX_AGENT_STEPS", "4"))
|
| 33 |
+
|
| 34 |
# default max number of tokens allowed in generated model responses
|
| 35 |
DEFAULT_MAX_TOKENS = int(os.getenv("DEFAULT_MAX_TOKENS", "1800"))
|
| 36 |
+
|
| 37 |
# deterministic random seed
|
| 38 |
RANDOM_STATE = int(os.getenv("RANDOM_STATE", "42"))
|
| 39 |
|
| 40 |
+
# Maximum ZeroGPU allocation for the decorated agent callback.
|
| 41 |
+
# Hugging Face ZeroGPU defaults to 60 seconds; this project allows more time
|
| 42 |
+
# because the agent can execute several bounded tool/inference steps.
|
| 43 |
+
ZERO_GPU_DURATION = int(os.getenv("ZERO_GPU_DURATION", "120"))
|
| 44 |
+
|
| 45 |
# lists the dataset file extensions accepted by the app
|
| 46 |
+
SUPPORTED_DATA_EXTENSIONS = {
|
| 47 |
+
".csv",
|
| 48 |
+
".parquet",
|
| 49 |
+
".json",
|
| 50 |
+
".jsonl",
|
| 51 |
+
".xlsx",
|
| 52 |
+
".xls",
|
| 53 |
+
}
|
| 54 |
|
| 55 |
# HF repo containing the bundled example dataset
|
| 56 |
EXAMPLE_DATASET_REPO = "scikit-learn/adult-census-income"
|
| 57 |
+
|
| 58 |
# filename of the example dataset within the repo
|
| 59 |
EXAMPLE_DATASET_FILE = "adult.csv"
|
| 60 |
+
|
| 61 |
# target column used for the example ML modeling task
|
| 62 |
+
EXAMPLE_DATASET_TARGET = "income"
|