Risalat commited on
Commit
f1b2329
·
verified ·
1 Parent(s): 8c5c24b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -16,7 +16,19 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
16
  arg1: the first argument
17
  arg2: the second argument
18
  """
19
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
 
16
  arg1: the first argument
17
  arg2: the second argument
18
  """
19
+ try:
20
+ # Generate image using the loaded tool
21
+ result = image_generation_tool(prompt=arg1)
22
+
23
+ # Check result format (it may vary depending on the tool's implementation)
24
+ if isinstance(result, str):
25
+ return f"Generated image URL: {result}"
26
+ elif isinstance(result, dict) and "image_url" in result:
27
+ return f"Generated image URL: {result['image_url']}"
28
+ else:
29
+ return f"Image generated successfully: {result}"
30
+ except Exception as e:
31
+ return f"Failed to generate image from prompt '{arg1}': {str(e)}"
32
 
33
  @tool
34
  def get_current_time_in_timezone(timezone: str) -> str: