Anesti commited on
Commit
78d6a49
·
verified ·
1 Parent(s): 27ee156

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -40,6 +40,16 @@ def random_fact() -> str:
40
  ]
41
  return random.choice(facts)
42
 
 
 
 
 
 
 
 
 
 
 
43
  @tool
44
  def get_current_time_in_timezone(timezone: str) -> str:
45
  """A tool that fetches the current local time in a specified timezone.
@@ -77,7 +87,7 @@ with open("prompts.yaml", 'r') as stream:
77
 
78
  agent = CodeAgent(
79
  model=model,
80
- tools=[final_answer], ## add your tools here (don't remove final answer)
81
  max_steps=6,
82
  verbosity_level=1,
83
  grammar=None,
 
40
  ]
41
  return random.choice(facts)
42
 
43
+ @tool
44
+ def generate_image_with_prompt(prompt: str) -> str:
45
+ """Generates an image based on the provided prompt."""
46
+ print(f"DEBUG: generate_image_with_prompt() was called with prompt: {prompt}")
47
+ try:
48
+ image_url = image_generation_tool.run(prompt)
49
+ return f"Here's your generated image: {image_url}"
50
+ except Exception as e:
51
+ return f"Error generating image: {str(e)}"
52
+
53
  @tool
54
  def get_current_time_in_timezone(timezone: str) -> str:
55
  """A tool that fetches the current local time in a specified timezone.
 
87
 
88
  agent = CodeAgent(
89
  model=model,
90
+ tools=[tell_joke,random_fact,generate_image_with_prompt,final_answer], ## add your tools here (don't remove final answer)
91
  max_steps=6,
92
  verbosity_level=1,
93
  grammar=None,