Nancy1906 commited on
Commit
81f2b27
·
verified ·
1 Parent(s): eef574c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -3,9 +3,15 @@ import gradio as gr
3
  import requests
4
  import inspect
5
  import pandas as pd
6
- from transformers import HfAgent
 
 
7
  from my_tools import tools
8
 
 
 
 
 
9
  # (Keep Constants as is)
10
  # --- Constants ---
11
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
@@ -22,8 +28,7 @@ class BasicAgent:
22
  print(f"Agent returning fixed answer: {fixed_answer}")
23
  return fixed_answer
24
  '''
25
- agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")
26
- agent.register_tools(tools)
27
 
28
  def run_and_submit_all( profile: gr.OAuthProfile | None):
29
  """
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ # --- NUEVO AGENTE ---
7
+ from huggingface_hub import InferenceClient
8
+ from transformers.tools.agents import Agent
9
  from my_tools import tools
10
 
11
+ client = InferenceClient()
12
+ agent = Agent(tools=tools, client=client)
13
+
14
+
15
  # (Keep Constants as is)
16
  # --- Constants ---
17
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
 
28
  print(f"Agent returning fixed answer: {fixed_answer}")
29
  return fixed_answer
30
  '''
31
+
 
32
 
33
  def run_and_submit_all( profile: gr.OAuthProfile | None):
34
  """