Anesti commited on
Commit
9178f3e
·
verified ·
1 Parent(s): 8bc70be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -56,7 +56,15 @@ def get_current_time_in_timezone(timezone: str) -> str:
56
  except Exception as e:
57
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
58
 
59
-
 
 
 
 
 
 
 
 
60
  final_answer = FinalAnswerTool()
61
 
62
  # 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:
@@ -78,7 +86,7 @@ with open("prompts.yaml", 'r') as stream:
78
 
79
  agent = CodeAgent(
80
  model=model,
81
- tools=[tell_joke,random_fact,final_answer], ## add your tools here (don't remove final answer)
82
  max_steps=6,
83
  verbosity_level=1,
84
  grammar=None,
 
56
  except Exception as e:
57
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
58
 
59
+ @tool
60
+ def generate_image_with_prompt(prompt: str) -> str:
61
+ """Generates an image based on the provided prompt."""
62
+ try:
63
+ image_url = image_generation_tool.run(prompt)
64
+ return f"Here's your generated image: {image_url}"
65
+ except Exception as e:
66
+ return f"Error generating image: {str(e)}"
67
+
68
  final_answer = FinalAnswerTool()
69
 
70
  # 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:
 
86
 
87
  agent = CodeAgent(
88
  model=model,
89
+ tools=[tell_joke,random_fact,generate_image_with_prompt,final_answer], ## add your tools here (don't remove final answer)
90
  max_steps=6,
91
  verbosity_level=1,
92
  grammar=None,