Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,8 @@ from smolagents import ToolCallingAgent
|
|
| 8 |
from smolagents import DuckDuckGoSearchTool
|
| 9 |
from smolagents import Tool
|
| 10 |
import traceback
|
|
|
|
|
|
|
| 11 |
# (Keep Constants as is)
|
| 12 |
# --- Constants ---
|
| 13 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
@@ -18,22 +20,22 @@ api = HfApi()
|
|
| 18 |
client = InferenceClient(token=api_key)
|
| 19 |
|
| 20 |
# Example list of chat/instruction models to test
|
| 21 |
-
|
| 22 |
-
"meta-llama/Llama-3.1-8B-Instruct",
|
| 23 |
"mistralai/Mistral-7B-Instruct-v0.3",
|
| 24 |
"HuggingFaceH4/zephyr-7b-beta",
|
| 25 |
"google/gemma-2b-it",
|
| 26 |
-
"tiiuae/falcon-7b-instruct"
|
|
|
|
| 27 |
]
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
try:
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
)
|
| 37 |
-
print(f"β
Accessible: {model_id}\n")
|
| 38 |
-
except Exception as e:
|
| 39 |
-
print(f"β Not accessible: {model_id} -> {e}\n")
|
|
|
|
| 8 |
from smolagents import DuckDuckGoSearchTool
|
| 9 |
from smolagents import Tool
|
| 10 |
import traceback
|
| 11 |
+
from huggingface_hub import InferenceClient, HfApi
|
| 12 |
+
from huggingface_hub.utils import HfHubHTTPError
|
| 13 |
# (Keep Constants as is)
|
| 14 |
# --- Constants ---
|
| 15 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
| 20 |
client = InferenceClient(token=api_key)
|
| 21 |
|
| 22 |
# Example list of chat/instruction models to test
|
| 23 |
+
models = [
|
|
|
|
| 24 |
"mistralai/Mistral-7B-Instruct-v0.3",
|
| 25 |
"HuggingFaceH4/zephyr-7b-beta",
|
| 26 |
"google/gemma-2b-it",
|
| 27 |
+
"tiiuae/falcon-7b-instruct",
|
| 28 |
+
"meta-llama/Llama-3.1-8B-Instruct"
|
| 29 |
]
|
| 30 |
|
| 31 |
+
client = InferenceClient()
|
| 32 |
+
api = HfApi()
|
| 33 |
+
|
| 34 |
+
for model in models:
|
| 35 |
+
print(f"π Testing {model}...")
|
| 36 |
try:
|
| 37 |
+
# just check if model exists and is accessible
|
| 38 |
+
api.model_info(model, token="your_HF_token_here")
|
| 39 |
+
print(f"β
Accessible: {model}")
|
| 40 |
+
except HfHubHTTPError as e:
|
| 41 |
+
print(f"β Not accessible: {model} -> {e}")
|
|
|
|
|
|
|
|
|
|
|
|