Spaces:
Configuration error
Configuration error
Fix HF API ERROR
Browse files- api/__pycache__/__init__.cpython-314.pyc +0 -0
- api/__pycache__/inference.cpython-314.pyc +0 -0
- app.py +5 -5
- tests/test_hf_router.py +30 -0
api/__pycache__/__init__.cpython-314.pyc
ADDED
|
Binary file (156 Bytes). View file
|
|
|
api/__pycache__/inference.cpython-314.pyc
ADDED
|
Binary file (2.59 kB). View file
|
|
|
app.py
CHANGED
|
@@ -312,20 +312,20 @@ st.sidebar.caption(
|
|
| 312 |
"Tables registered: " + (", ".join(dfs.keys()) if dfs else "none — upload to begin")
|
| 313 |
)
|
| 314 |
|
| 315 |
-
provider_default = os.getenv("LLM_PROVIDER", "
|
| 316 |
-
provider_choices = ["fireworks", "
|
| 317 |
provider_index = provider_choices.index(provider_default) if provider_default in provider_choices else 0
|
| 318 |
provider = st.sidebar.selectbox("Provider", provider_choices, index=provider_index)
|
| 319 |
|
| 320 |
gen_default = os.getenv(
|
| 321 |
"LLM_MODEL_GEN",
|
| 322 |
-
"
|
| 323 |
if provider == "fireworks"
|
| 324 |
else "Qwen/Qwen2.5-1.5B-Instruct",
|
| 325 |
)
|
| 326 |
rev_default = os.getenv(
|
| 327 |
"LLM_MODEL_REV",
|
| 328 |
-
"
|
| 329 |
if provider == "fireworks"
|
| 330 |
else "Qwen/Qwen2.5-Coder-1.5B-Instruct",
|
| 331 |
)
|
|
@@ -622,4 +622,4 @@ LIMIT 200;
|
|
| 622 |
_render_placeholder(
|
| 623 |
"Placeholder: Dashboard requires tables with day/category/units/revenue columns.",
|
| 624 |
["daily_product_sales"]
|
| 625 |
-
)
|
|
|
|
| 312 |
"Tables registered: " + (", ".join(dfs.keys()) if dfs else "none — upload to begin")
|
| 313 |
)
|
| 314 |
|
| 315 |
+
provider_default = os.getenv("LLM_PROVIDER", "hf_router").lower()
|
| 316 |
+
provider_choices = ["fireworks", "hf_router"]
|
| 317 |
provider_index = provider_choices.index(provider_default) if provider_default in provider_choices else 0
|
| 318 |
provider = st.sidebar.selectbox("Provider", provider_choices, index=provider_index)
|
| 319 |
|
| 320 |
gen_default = os.getenv(
|
| 321 |
"LLM_MODEL_GEN",
|
| 322 |
+
"Qwen/Qwen3-Coder-30B-A3B-Instruct:fireworks-ai"
|
| 323 |
if provider == "fireworks"
|
| 324 |
else "Qwen/Qwen2.5-1.5B-Instruct",
|
| 325 |
)
|
| 326 |
rev_default = os.getenv(
|
| 327 |
"LLM_MODEL_REV",
|
| 328 |
+
"Qwen/Qwen3-Coder-30B-A3B-Instruct:fireworks-ai"
|
| 329 |
if provider == "fireworks"
|
| 330 |
else "Qwen/Qwen2.5-Coder-1.5B-Instruct",
|
| 331 |
)
|
|
|
|
| 622 |
_render_placeholder(
|
| 623 |
"Placeholder: Dashboard requires tables with day/category/units/revenue columns.",
|
| 624 |
["daily_product_sales"]
|
| 625 |
+
)
|
tests/test_hf_router.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Smoke test for HF Router integration"""
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
+
sys.path.append('.')
|
| 5 |
+
|
| 6 |
+
from api.inference import _call_llm
|
| 7 |
+
|
| 8 |
+
def test_hf_router_basic():
|
| 9 |
+
"""Test that HF Router can answer a simple question"""
|
| 10 |
+
try:
|
| 11 |
+
# Set required env vars if not present
|
| 12 |
+
if not os.getenv("HF_TOKEN"):
|
| 13 |
+
print("⚠️ HF_TOKEN not set, skipping HF Router test")
|
| 14 |
+
return True
|
| 15 |
+
|
| 16 |
+
response = _call_llm("What is the capital of France?")
|
| 17 |
+
print(f"HF Router response: {response}")
|
| 18 |
+
|
| 19 |
+
# Basic sanity check
|
| 20 |
+
assert "paris" in response.lower(), f"Expected 'Paris' in response, got: {response}"
|
| 21 |
+
print("✅ HF Router test passed")
|
| 22 |
+
return True
|
| 23 |
+
|
| 24 |
+
except Exception as e:
|
| 25 |
+
print(f"❌ HF Router test failed: {e}")
|
| 26 |
+
return False
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
success = test_hf_router_basic()
|
| 30 |
+
sys.exit(0 if success else 1)
|