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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -22,15 +22,19 @@ 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):
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:
 
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 and saves it locally.
28
 
29
  Args:
30
  prompt: A detailed description of the image to generate.
31
  """
32
  image = image_generation_tool(prompt)
33
+
34
+ filename = f"{uuid.uuid4()}.png"
35
+ image.save(filename)
36
+
37
+ return filename
38
 
39
  @tool
40
  def get_current_time_in_timezone(timezone: str) -> str: