yangminded commited on
Commit
3c2f89b
·
verified ·
1 Parent(s): 0ad45fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -53,22 +53,39 @@ def delay_execution(agent):
53
  time.sleep(5)
54
 
55
  # Agent stuff starts here
 
56
  class BasicAgent:
57
  def __init__(self):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
59
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
60
  model = InferenceClientModel(
61
- #model_id='Qwen/Qwen2.5-VL-72B-Instruct',
62
- #provider='nebius',
63
  token=os.getenv('HF_Token'))
64
 
65
  self.agent = CodeAgent(
66
  model=model,
67
  tools=[FinalAnswerTool(), BroadfieldWebsearch(), VisitWebpageTool()], ## add your tools here (don't remove final answer),
68
- additional_authorized_imports=['pandas', 'requests', 'markdownify'],
69
  max_steps=10,
70
  verbosity_level=1,
71
- step_callbacks=[delay_execution]
 
72
  )
73
 
74
 
 
53
  time.sleep(5)
54
 
55
  # Agent stuff starts here
56
+
57
  class BasicAgent:
58
  def __init__(self):
59
+ # Initialize a VLM for Image understanding
60
+ vlmodel = InferenceClientModel(model_id='Qwen/Qwen2.5-VL-72B-Instruct')
61
+
62
+ # Create the agent
63
+ self.vlm_agent = CodeAgent(
64
+ tools=[],
65
+ model=vlmodel,
66
+ additional_authorized_imports=[],
67
+ step_callbacks=[],
68
+ max_steps=5,
69
+ verbosity_level=2,
70
+ name='image_understanding_agent',
71
+ description='Gives textual descriptions of images.'
72
+ )
73
+
74
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
75
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
76
  model = InferenceClientModel(
77
+ model_id='deepseek-ai/DeepSeek-R1-0528',
78
+ provider='nebius',
79
  token=os.getenv('HF_Token'))
80
 
81
  self.agent = CodeAgent(
82
  model=model,
83
  tools=[FinalAnswerTool(), BroadfieldWebsearch(), VisitWebpageTool()], ## add your tools here (don't remove final answer),
84
+ additional_authorized_imports=['pandas', 'requests', 'markdownify', 'openpyxl'],
85
  max_steps=10,
86
  verbosity_level=1,
87
+ step_callbacks=[delay_execution],
88
+ managed_agents=[self.vlm_agent]
89
  )
90
 
91