priyar84 commited on
Commit
ad7b87d
·
verified ·
1 Parent(s): 3028cc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -11,11 +11,13 @@ from Gradio_UI import GradioUI
11
  def my_custom_tool(userprompt: str) -> str: #it's import to specify the return type
12
  """A tool that does helps to generate the image for the given text prompt
13
  Args:
14
- userprompt(str): A string that describes about the image to generate
15
  Returns:
16
- str: A URL to the generated image.
17
  """
18
- return "Generated image URL"
 
 
19
 
20
  @tool
21
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -46,9 +48,6 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct', # it is possible that this mod
46
  custom_role_conversions=None,
47
  )
48
 
49
- # Import tool from Hub
50
- image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
51
-
52
  # Load prompt templates
53
  with open("prompts.yaml", 'r') as stream:
54
  prompt_templates = yaml.safe_load(stream)
@@ -66,7 +65,5 @@ agent = CodeAgent(
66
  prompt_templates=prompt_templates
67
  )
68
 
69
- agent.run("What is 24*7?")
70
-
71
  # Launch the AI agent with Gradio
72
  GradioUI(agent).launch()
 
11
  def my_custom_tool(userprompt: str) -> str: #it's import to specify the return type
12
  """A tool that does helps to generate the image for the given text prompt
13
  Args:
14
+ userprompt: A string prompt that helps the image to generate
15
  Returns:
16
+ str: A generated image.
17
  """
18
+ # Import tool from Hub
19
+ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
20
+ return image_generation_tool(userprompt)
21
 
22
  @tool
23
  def get_current_time_in_timezone(timezone: str) -> str:
 
48
  custom_role_conversions=None,
49
  )
50
 
 
 
 
51
  # Load prompt templates
52
  with open("prompts.yaml", 'r') as stream:
53
  prompt_templates = yaml.safe_load(stream)
 
65
  prompt_templates=prompt_templates
66
  )
67
 
 
 
68
  # Launch the AI agent with Gradio
69
  GradioUI(agent).launch()