charlesfeng1 commited on
Commit
b1b3d97
·
verified ·
1 Parent(s): 683fdf2

fixed error

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -33,12 +33,14 @@ def get_current_time_in_timezone(timezone: str) -> str:
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
- image_generation_tool = Tool.from_space(
37
  "black-forest-labs/FLUX.1-schnell",
38
  name="image_generator",
39
  description="Generate an image from a prompt"
40
  )
41
 
 
 
42
  final_answer = FinalAnswerTool()
43
 
44
  # 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:
@@ -53,14 +55,14 @@ custom_role_conversions=None,
53
 
54
 
55
  # Import tool from Hub
56
- image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
57
 
58
  with open("prompts.yaml", 'r') as stream:
59
  prompt_templates = yaml.safe_load(stream)
60
 
61
  agent = CodeAgent(
62
  model=model,
63
- tools=[final_answer, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
64
  max_steps=6,
65
  verbosity_level=1,
66
  grammar=None,
 
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
+ image_generation_tool = tool.from_space(
37
  "black-forest-labs/FLUX.1-schnell",
38
  name="image_generator",
39
  description="Generate an image from a prompt"
40
  )
41
 
42
+ search_web = DuckDuckGoSearchTool()
43
+ visit_page = VisitWebpageTool()
44
  final_answer = FinalAnswerTool()
45
 
46
  # 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:
 
55
 
56
 
57
  # Import tool from Hub
58
+ #image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
59
 
60
  with open("prompts.yaml", 'r') as stream:
61
  prompt_templates = yaml.safe_load(stream)
62
 
63
  agent = CodeAgent(
64
  model=model,
65
+ tools=[final_answer, get_current_time_in_timezone, image_generation_tool, search_web, visit_page], ## add your tools here (don't remove final answer)
66
  max_steps=6,
67
  verbosity_level=1,
68
  grammar=None,