Spaces:
Sleeping
Sleeping
Ajjack4 commited on
Commit ·
a07333b
1
Parent(s): 5d4432b
default ENV_BASE_URL to localhost:7860 — validator runs container there before inference.py
Browse files- inference.py +5 -3
inference.py
CHANGED
|
@@ -40,7 +40,9 @@ API_KEY: str = (
|
|
| 40 |
)
|
| 41 |
|
| 42 |
LOCAL_IMAGE_NAME: str = os.getenv("LOCAL_IMAGE_NAME", "")
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
|
| 45 |
if not API_KEY:
|
| 46 |
print("[DEBUG] Warning: no API key set (API_KEY / HF_TOKEN / OPENAI_API_KEY).", flush=True)
|
|
@@ -306,9 +308,9 @@ async def main() -> None:
|
|
| 306 |
if LOCAL_IMAGE_NAME:
|
| 307 |
env_url = start_env_container(LOCAL_IMAGE_NAME)
|
| 308 |
if not env_url:
|
| 309 |
-
env_url = ENV_BASE_URL
|
| 310 |
else:
|
| 311 |
-
env_url = ENV_BASE_URL or
|
| 312 |
|
| 313 |
print(f"[DEBUG] Using env URL: {env_url}", flush=True)
|
| 314 |
print(f"[DEBUG] Using API_BASE_URL: {API_BASE_URL}", flush=True)
|
|
|
|
| 40 |
)
|
| 41 |
|
| 42 |
LOCAL_IMAGE_NAME: str = os.getenv("LOCAL_IMAGE_NAME", "")
|
| 43 |
+
# Validator runs our Docker container at localhost:7860 before running inference.py.
|
| 44 |
+
# LOCAL_IMAGE_NAME is used when we need to start it ourselves.
|
| 45 |
+
ENV_BASE_URL: str = os.getenv("ENV_BASE_URL", "http://localhost:7860")
|
| 46 |
|
| 47 |
if not API_KEY:
|
| 48 |
print("[DEBUG] Warning: no API key set (API_KEY / HF_TOKEN / OPENAI_API_KEY).", flush=True)
|
|
|
|
| 308 |
if LOCAL_IMAGE_NAME:
|
| 309 |
env_url = start_env_container(LOCAL_IMAGE_NAME)
|
| 310 |
if not env_url:
|
| 311 |
+
env_url = ENV_BASE_URL # already defaults to localhost:7860
|
| 312 |
else:
|
| 313 |
+
env_url = ENV_BASE_URL # localhost:7860 or whatever validator set
|
| 314 |
|
| 315 |
print(f"[DEBUG] Using env URL: {env_url}", flush=True)
|
| 316 |
print(f"[DEBUG] Using API_BASE_URL: {API_BASE_URL}", flush=True)
|