File size: 1,188 Bytes
10e9b7d
 
eccf8e4
7d65c66
3c4371f
be3b5a2
 
 
 
 
d59f015
e80aab9
3db6293
c89d174
b2ab5d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4331ead
 
 
 
 
b2ab5d7
 
c4f4fa4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import gradio as gr
import requests
import inspect
import pandas as pd
from smolagents.models import InferenceClientModel
from smolagents import ToolCallingAgent
from smolagents import DuckDuckGoSearchTool
from smolagents import Tool
import traceback
# (Keep Constants as is)
# --- Constants ---
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
print("Token loaded:", bool(os.getenv("chatbotagenthf")))
from huggingface_hub import InferenceClient, HfApi
api_key=os.getenv("chatbotagenthf")
api = HfApi()
client = InferenceClient(token=api_key)

# Example list of chat/instruction models to test
models_to_test = [
    "meta-llama/Llama-3.1-8B-Instruct",
    "mistralai/Mistral-7B-Instruct-v0.3",
    "HuggingFaceH4/zephyr-7b-beta",
    "google/gemma-2b-it",
    "tiiuae/falcon-7b-instruct"
]

for model_id in models_to_test:
    try:
        print(f"🔎 Testing {model_id}...")
        response = client.conversational(
            inputs="Hello! How are you?",
            model=model_id,
            max_new_tokens=20
        )
        print(f"✅ Accessible: {model_id}\n")
    except Exception as e:
        print(f"❌ Not accessible: {model_id} -> {e}\n")