Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,8 +48,20 @@ custom_role_conversions=None,
|
|
| 48 |
|
| 49 |
|
| 50 |
# Import tool from Hub
|
|
|
|
|
|
|
| 51 |
@tool
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
with open("prompts.yaml", 'r') as stream:
|
| 55 |
prompt_templates = yaml.safe_load(stream)
|
|
|
|
| 48 |
|
| 49 |
|
| 50 |
# Import tool from Hub
|
| 51 |
+
# @tool
|
| 52 |
+
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 53 |
@tool
|
| 54 |
+
def get_image_generation_tool() -> str:
|
| 55 |
+
"""Loads the image generation tool for generating images from text prompts.
|
| 56 |
+
|
| 57 |
+
Returns:
|
| 58 |
+
A string confirming the tool has been loaded successfully.
|
| 59 |
+
"""
|
| 60 |
+
try:
|
| 61 |
+
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 62 |
+
return "Image generation tool has been successfully loaded."
|
| 63 |
+
except Exception as e:
|
| 64 |
+
return f"Error loading image generation tool: {str(e)}"
|
| 65 |
|
| 66 |
with open("prompts.yaml", 'r') as stream:
|
| 67 |
prompt_templates = yaml.safe_load(stream)
|