RobotJelly commited on
Commit
f8ef3ad
·
verified ·
1 Parent(s): 51cb115

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -19,14 +19,15 @@ def my_custom_tool(arg1:str, img: bool)-> Any: #it's import to specify the retur
19
  """A tool that uses 'DuckDuckGoSearchTool' tool to answer any query and 'image_generation_tool' tool to generate image.
20
  Args:
21
  arg1: string query to be used to search answer via given search tool.
22
- img: boolean value in TRUE/FALSE if TRUE then use 'arg1' as prompt for 'image_generation_tool'.
23
  """
24
  try:
25
  if img:
 
26
  # Import tool from Hub
27
- image_generation_tool = load_tool("dwb2023/text-to-image", trust_remote_code=True)
28
  #image_generation_tool(arg1)
29
- launch_gradio_demo(image_generation_tool(arg1))
30
  else:
31
  search_obj = DuckDuckGoSearchTool()
32
  answer = search_obj(arg1)
@@ -64,14 +65,14 @@ custom_role_conversions=None,
64
 
65
 
66
  # # Import tool from Hub
67
- #image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
68
 
69
  with open("prompts.yaml", 'r') as stream:
70
  prompt_templates = yaml.safe_load(stream)
71
 
72
  agent = CodeAgent(
73
  model=model,
74
- tools=[final_answer,my_custom_tool,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
75
  max_steps=6,
76
  verbosity_level=1,
77
  grammar=None,
 
19
  """A tool that uses 'DuckDuckGoSearchTool' tool to answer any query and 'image_generation_tool' tool to generate image.
20
  Args:
21
  arg1: string query to be used to search answer via given search tool.
22
+ img: boolean value in TRUE/FALSE if FALSE then use another tool.
23
  """
24
  try:
25
  if img:
26
+ return
27
  # Import tool from Hub
28
+ #image_generation_tool = load_tool("dwb2023/text-to-image", trust_remote_code=True)
29
  #image_generation_tool(arg1)
30
+ #launch_gradio_demo(image_generation_tool(arg1))
31
  else:
32
  search_obj = DuckDuckGoSearchTool()
33
  answer = search_obj(arg1)
 
65
 
66
 
67
  # # Import tool from Hub
68
+ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
69
 
70
  with open("prompts.yaml", 'r') as stream:
71
  prompt_templates = yaml.safe_load(stream)
72
 
73
  agent = CodeAgent(
74
  model=model,
75
+ tools=[final_answer,my_custom_tool,image_generation_tool,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
76
  max_steps=6,
77
  verbosity_level=1,
78
  grammar=None,