zineb-chgari commited on
Commit
4b8b9e9
Β·
verified Β·
1 Parent(s): 4331ead

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
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
- models_to_test = [
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
- for model_id in models_to_test:
 
 
 
 
30
  try:
31
- print(f"πŸ”Ž Testing {model_id}...")
32
- response = client.conversational(
33
- inputs="Hello! How are you?",
34
- model=model_id,
35
- max_new_tokens=20
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}")