Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- inference.py +6 -5
inference.py
CHANGED
|
@@ -9,11 +9,12 @@ Mandatory env variables (injected by validator):
|
|
| 9 |
Optional:
|
| 10 |
SERVER_URL Running env server (default: http://localhost:8000)
|
| 11 |
|
| 12 |
-
|
| 13 |
API_BASE_URL=<url> API_KEY=<key> python inference.py
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 17 |
"""
|
| 18 |
|
| 19 |
import os
|
|
@@ -50,9 +51,9 @@ except ImportError:
|
|
| 50 |
# Configuration — read from env at import time (matches sample script pattern)
|
| 51 |
# ---------------------------------------------------------------------------
|
| 52 |
|
| 53 |
-
API_BASE_URL = os.environ
|
| 54 |
MODEL_NAME = os.environ.get("MODEL_NAME") or "gpt-4.1-mini"
|
| 55 |
-
API_KEY = os.environ
|
| 56 |
SERVER_URL = os.environ.get("SERVER_URL", "http://localhost:8000")
|
| 57 |
|
| 58 |
SEED = 42
|
|
|
|
| 9 |
Optional:
|
| 10 |
SERVER_URL Running env server (default: http://localhost:8000)
|
| 11 |
|
| 12 |
+
Usage:
|
| 13 |
API_BASE_URL=<url> API_KEY=<key> python inference.py
|
| 14 |
|
| 15 |
+
CRITICAL: This script REQUIRES API_BASE_URL and API_KEY from environment.
|
| 16 |
+
No fallbacks or hardcoded values are used.
|
| 17 |
+
The validator injects these to route calls through LiteLLM proxy.
|
| 18 |
"""
|
| 19 |
|
| 20 |
import os
|
|
|
|
| 51 |
# Configuration — read from env at import time (matches sample script pattern)
|
| 52 |
# ---------------------------------------------------------------------------
|
| 53 |
|
| 54 |
+
API_BASE_URL = os.environ["API_BASE_URL"]
|
| 55 |
MODEL_NAME = os.environ.get("MODEL_NAME") or "gpt-4.1-mini"
|
| 56 |
+
API_KEY = os.environ["API_KEY"]
|
| 57 |
SERVER_URL = os.environ.get("SERVER_URL", "http://localhost:8000")
|
| 58 |
|
| 59 |
SEED = 42
|