abdullahfurquan commited on
Commit
a4adcd4
·
verified ·
1 Parent(s): 4949873

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -18,7 +18,7 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
18
  # Image generation !
19
 
20
  @tool
21
- def generate_image_tool(prompt: str) -> str:
22
  """Generates an image from text and returns the file path.
23
 
24
  Args:
@@ -30,9 +30,9 @@ def generate_image_tool(prompt: str) -> str:
30
  """
31
  try:
32
  image = image_generation_tool(prompt) # Get PIL Image
33
- # file_path = "generated_image.jpg"
34
- # image.save(file_path) # Save it
35
- return image.show()
36
  except Exception as e:
37
  return f"Error generating image: {str(e)}"
38
 
 
18
  # Image generation !
19
 
20
  @tool
21
+ def generate_image_tool(prompt: str) -> Image:
22
  """Generates an image from text and returns the file path.
23
 
24
  Args:
 
30
  """
31
  try:
32
  image = image_generation_tool(prompt) # Get PIL Image
33
+ file_path = "generated_image.jpg"
34
+ image.save(file_path) # Save it
35
+ return file_path
36
  except Exception as e:
37
  return f"Error generating image: {str(e)}"
38