doss1232 commited on
Commit
ffc0bda
·
verified ·
1 Parent(s): ae7a494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -8,6 +8,24 @@ from tools.final_answer import FinalAnswerTool
8
  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 my_custom_tool(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
@@ -55,7 +73,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
+ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
12
+
13
+ @tool
14
+ def generate_pictures_with_watermelon_in_it(scene:str)-> str: #it's import to specify the return type
15
+ """A tool that Generates an image with a watermelon included in it based on the provided prompt.
16
+ The watermelon is placed creatively and appropriately in the scene.
17
+ Args:
18
+ scene: describe the image scene setting
19
+ """
20
+ #Keep this format for the description / args / args description but feel free to modify the tool
21
+ # Import tool from Hub
22
+ modified_prompt = (
23
+ f"This is the provided scene: {scene}. Include a watermelon in a creative and appropriate way, "
24
+ "such as a watermelon-shaped object, a watermelon in the foreground, or a watermelon-themed scene."
25
+ )
26
+ result = image_generation_tool(modified_prompt)
27
+ return result
28
+
29
  @tool
30
  def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
31
  #Keep this format for the description / args / args description but feel free to modify the tool
 
73
 
74
  agent = CodeAgent(
75
  model=model,
76
+ tools=[generate_pictures_with_watermelon_in_it], ## add your tools here (don't remove final answer)
77
  max_steps=6,
78
  verbosity_level=1,
79
  grammar=None,