vechism commited on
Commit
3acb222
·
verified ·
1 Parent(s): f399991

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -10,11 +10,13 @@ from Gradio_UI import GradioUI
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
- def mutante_unicorn(theme:str) -> str: #it's import to specify the return type
14
  #Keep this format for the description / args / args description but feel free to modify the tool
15
- """A tool that generates a close-up photograph of a mutant unicorn based from the name of any animal.
 
 
16
  Args:
17
- theme: A string representing a name of any animal.
18
  """
19
  try:
20
  # Import tool from Hub
@@ -25,15 +27,15 @@ def mutante_unicorn(theme:str) -> str: #it's import to specify the return type
25
  description="Generate image from prompt"
26
  )
27
  '''
28
- description = f'''
29
- aa close-up photograph of a {theme} unicorn with butterfly wings holding a small brightfull orb with its tiny paws,
30
- looking at the center of the orb with a concentrated gaze. The unicorn is in
31
- a clearing in the forest on a moonlit night'''
32
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
33
- image = image_generation_tool(description)
34
  return final_answer(image)
35
  except Exception as e:
36
- return f"Error creating card for theme '{theme}': {str(e)}"
37
 
38
  #image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
39
 
 
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
+ def mutante_unicorn(animal_name:str) -> str: #it's import to specify the return type
14
  #Keep this format for the description / args / args description but feel free to modify the tool
15
+ """A tool that generates a close-up photograph of a mutant unicorn based on an animal name (e.g. tiger, duck, snake, etc).
16
+ This mutant unicorn has butterfly wings and is holding a small brightfull orb with its tiny paws, looking at the center
17
+ of the orb with a concentrated gaze. The unicorn is in a clearing in the forest on a moonlit night.
18
  Args:
19
+ animal_name: A string representing a name of any animal.
20
  """
21
  try:
22
  # Import tool from Hub
 
27
  description="Generate image from prompt"
28
  )
29
  '''
30
+ #description = f'''
31
+ #aa close-up photograph of a {theme} unicorn with butterfly wings holding a small brightfull orb with its tiny paws,
32
+ #looking at the center of the orb with a concentrated gaze. The unicorn is in
33
+ #a clearing in the forest on a moonlit night'''
34
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
35
+ image = image_generation_tool(animal_name)
36
  return final_answer(image)
37
  except Exception as e:
38
+ return f"Error creating card for theme '{animal_name}': {str(e)}"
39
 
40
  #image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
41