subham73 commited on
Commit
44dc491
·
verified ·
1 Parent(s): 9c6af94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -41,20 +41,21 @@ def get_current_time_in_timezone(timezone: str) -> str:
41
  except Exception as e:
42
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
43
 
44
- # Import tool from Hub
45
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
46
 
47
  @tool
48
- def text_to_image(text: str) -> image:
49
- """A tool that takes string and creates image with textual information.
 
50
  Args:
51
- text: A string representing the textual information about the image to be created.
 
 
52
  """
53
- try :
54
  return image_generation_tool(text)
55
-
56
  except Exception as e:
57
- return "Error creating the image"
58
 
59
  final_answer = FinalAnswerTool()
60
 
 
41
  except Exception as e:
42
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
43
 
 
44
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
45
 
46
  @tool
47
+ def text_to_image(text: str) -> str:
48
+ """
49
+ A tool that takes a string and creates an image with textual information.
50
  Args:
51
+ text (str): A string representing the textual information about the image to be created.
52
+ Returns:
53
+ str: Image URL or path
54
  """
55
+ try:
56
  return image_generation_tool(text)
 
57
  except Exception as e:
58
+ return f"Error creating the image: {str(e)}"
59
 
60
  final_answer = FinalAnswerTool()
61