Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,23 @@ def random_fact() -> str:
|
|
| 39 |
"Bananas are berries, but strawberries are not."
|
| 40 |
]
|
| 41 |
return random.choice(facts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
@tool
|
| 45 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -56,14 +72,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 56 |
except Exception as e:
|
| 57 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 58 |
|
| 59 |
-
@tool
|
| 60 |
-
def generate_image_with_prompt(prompt: str) -> str:
|
| 61 |
-
"""Generates an image based on the provided prompt."""
|
| 62 |
-
try:
|
| 63 |
-
image_url = image_generation_tool.run(prompt)
|
| 64 |
-
return f"Here's your generated image: {image_url}"
|
| 65 |
-
except Exception as e:
|
| 66 |
-
return f"Error generating image: {str(e)}"
|
| 67 |
|
| 68 |
final_answer = FinalAnswerTool()
|
| 69 |
|
|
|
|
| 39 |
"Bananas are berries, but strawberries are not."
|
| 40 |
]
|
| 41 |
return random.choice(facts)
|
| 42 |
+
|
| 43 |
+
@tool
|
| 44 |
+
def generate_car_image() -> str:
|
| 45 |
+
"""
|
| 46 |
+
Generates an image of a car using a text-to-image generation tool.
|
| 47 |
|
| 48 |
+
Returns:
|
| 49 |
+
A string containing the URL of the generated car image.
|
| 50 |
+
"""
|
| 51 |
+
# Define the prompt specifically for a car image
|
| 52 |
+
prompt = "A high-resolution image of a sleek modern car driving on a scenic road."
|
| 53 |
+
try:
|
| 54 |
+
image_url = image_generation_tool.run(prompt)
|
| 55 |
+
return f"Here's your generated car image: {image_url}"
|
| 56 |
+
except Exception as e:
|
| 57 |
+
return f"Error generating car image: {str(e)}"
|
| 58 |
+
|
| 59 |
|
| 60 |
@tool
|
| 61 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 72 |
except Exception as e:
|
| 73 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
final_answer = FinalAnswerTool()
|
| 77 |
|