Deltan2002 commited on
Commit
e54a150
·
verified ·
1 Parent(s): 38de1fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -9,17 +9,24 @@ from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def addition(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """Addition tool that adds 2 numbers
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
 
 
 
18
  """
19
- num = int(arg1)
20
- num3 = num + arg2
21
 
22
- return num3
 
 
 
 
 
23
 
24
  @tool
25
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -58,7 +65,7 @@ with open("prompts.yaml", 'r') as stream:
58
 
59
  agent = CodeAgent(
60
  model=model,
61
- tools=[final_answer, addition], ## add your tools here (don't remove final answer)
62
  max_steps=6,
63
  verbosity_level=1,
64
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def meme_generator(theme: str, character: str) -> str:
13
+ """A tool that generates a meme image using the given theme and character.
14
+
15
  Args:
16
+ theme: The theme of the meme (e.g., "motivational", "funny", "sarcastic").
17
+ character: The character to feature in the meme (e.g., "cat", "superhero").
18
+
19
+ Returns:
20
+ A string representing the URL or description of the generated meme image.
21
  """
22
+ prompt = f"Create a meme with a {theme} theme featuring a {character}. The meme should be humorous and visually appealing."
 
23
 
24
+ try:
25
+ image_result = image_generation_tool(prompt=prompt)
26
+ return image_result
27
+ except Exception as e:
28
+ return f"Error generating meme: {str(e)}"
29
+
30
 
31
  @tool
32
  def get_current_time_in_timezone(timezone: str) -> str:
 
65
 
66
  agent = CodeAgent(
67
  model=model,
68
+ tools=[final_answer, search_tool, ], ## add your tools here (don't remove final answer)
69
  max_steps=6,
70
  verbosity_level=1,
71
  grammar=None,