Spaces:
Runtime error
Runtime error
Update app.py
Browse filesFirst draft of generate_image function
app.py
CHANGED
|
@@ -50,6 +50,16 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 50 |
except Exception as e:
|
| 51 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
final_answer = FinalAnswerTool()
|
| 55 |
|
|
|
|
| 50 |
except Exception as e:
|
| 51 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 52 |
|
| 53 |
+
@tool
|
| 54 |
+
def generate_image(description: str) -> image:
|
| 55 |
+
"""A tool that generates an image from a text description.
|
| 56 |
+
Args:
|
| 57 |
+
description: A string representing the text description to generate an image of.
|
| 58 |
+
"""
|
| 59 |
+
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 60 |
+
return image_generation_tool(description)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
|
| 64 |
final_answer = FinalAnswerTool()
|
| 65 |
|