Spaces:
Runtime error
Runtime error
| 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") |