srkdev384 commited on
Commit
71097bd
·
verified ·
1 Parent(s): c9b8877

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -22,23 +22,15 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
22
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
23
 
24
  @tool
25
- def generate_image(prompt: str) -> str:
26
  """
27
  Generates an image from a text prompt.
28
 
29
  Args:
30
  prompt: A detailed description of the image to generate.
31
  """
32
- try:
33
- image = image_generation_tool(prompt) # directly get image
34
-
35
- filename = f"{uuid.uuid4()}.png"
36
- image.save(filename)
37
-
38
- return filename
39
-
40
- except Exception as e:
41
- return f"Error generating image: {str(e)}"
42
 
43
  @tool
44
  def get_current_time_in_timezone(timezone: str) -> str:
 
22
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
23
 
24
  @tool
25
+ def generate_image(prompt: str):
26
  """
27
  Generates an image from a text prompt.
28
 
29
  Args:
30
  prompt: A detailed description of the image to generate.
31
  """
32
+ image = image_generation_tool(prompt)
33
+ return image
 
 
 
 
 
 
 
 
34
 
35
  @tool
36
  def get_current_time_in_timezone(timezone: str) -> str: