zineb-chgari commited on
Commit
b2ab5d7
·
verified ·
1 Parent(s): ebf176f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -1
app.py CHANGED
@@ -12,6 +12,28 @@ import traceback
12
  # --- Constants ---
13
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
  print("Token loaded:", bool(os.getenv("chatbotagenthf")))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  custom_prompt = """
16
  You are an intelligent AI agent participating in the GALA (Generative Agent Learning Assignment).
17
  Your goal is to answer each question accurately, concisely, and factually.
@@ -55,7 +77,7 @@ class BasicAgent:
55
  def __init__(self):
56
  try:
57
  api_key=os.getenv("chatbotagenthf")
58
- model =InferenceClientModel(model_id="meta-llama/Llama-3.3-70B-Instruct-Turbo-Free", provider="together",token=api_key)
59
 
60
  self.agent = ToolCallingAgent(
61
  tools=[DuckDuckGoSearchTool()],
 
12
  # --- Constants ---
13
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
  print("Token loaded:", bool(os.getenv("chatbotagenthf")))
15
+ from huggingface_hub import InferenceClient, HfApi
16
+ api_key=os.getenv("chatbotagenthf")
17
+ 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
+ client.text_generation("Hello!", model=model_id, max_new_tokens=10)
33
+ print(f"✅ Accessible: {model_id}\n")
34
+ except Exception as e:
35
+ print(f"❌ Not accessible: {model_id} -> {e}\n")
36
+
37
  custom_prompt = """
38
  You are an intelligent AI agent participating in the GALA (Generative Agent Learning Assignment).
39
  Your goal is to answer each question accurately, concisely, and factually.
 
77
  def __init__(self):
78
  try:
79
  api_key=os.getenv("chatbotagenthf")
80
+ model =InferenceClientModel(model_id="meta-llama/Llama-3.3-70B-Instruct-Turbo-Free",token=api_key)
81
 
82
  self.agent = ToolCallingAgent(
83
  tools=[DuckDuckGoSearchTool()],