Spaces:
Sleeping
Sleeping
File size: 1,143 Bytes
2a86392 c9b8fea 9b5b26a c9b8fea c1ae7de 250d404 8fe992b c1ae7de 41c23fb c1ae7de 41c23fb c1ae7de 41c23fb c1ae7de 41c23fb c1ae7de 41c23fb 250d404 41c23fb c1ae7de 41c23fb c1ae7de bbfa55b f49ef96 |
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 40 41 42 43 44 45 46 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
import datetime
import requests
import pytz
import yaml
from tools.final_answer import FinalAnswerTool
from typing import Any, Optional
from smolagents.tools import Tool
import markdownify
import smolagents
import re
from tools.visit_webpage import VisitWebpageTool
# Initialize the final answer tool
final_answer = FinalAnswerTool()
# Define the Hugging Face model
model = HfApiModel(
max_tokens=2096,
temperature=0.5,
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
custom_role_conversions=None,
)
# Load prompt templates
with open("prompts.yaml", 'r') as stream:
prompt_templates = yaml.safe_load(stream)
# Create the agent
agent = CodeAgent(
model=model,
tools=[final_answer, VisitWebpageTool()],
max_steps=6,
verbosity_level=1,
grammar=None,
planning_interval=None,
name="Webpage Visitor Agent",
description="An agent that visits a webpage and extracts content & device information.",
prompt_templates=prompt_templates
)
# Launch the agent
from Gradio_UI import GradioUI
GradioUI(agent).launch()
|