Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,9 +97,20 @@ model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',#
|
|
| 97 |
custom_role_conversions=None,
|
| 98 |
)
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
# Import tool from Hub
|
| 102 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 103 |
|
| 104 |
with open("prompts.yaml", 'r') as stream:
|
| 105 |
prompt_templates = yaml.safe_load(stream)
|
|
|
|
| 97 |
custom_role_conversions=None,
|
| 98 |
)
|
| 99 |
|
| 100 |
+
@tool
|
| 101 |
+
def image_generation_tool(promt: str)->any:
|
| 102 |
+
"""A tool that generate image from user`s promt.
|
| 103 |
+
Args:
|
| 104 |
+
promt: description of image
|
| 105 |
+
"""
|
| 106 |
+
try:
|
| 107 |
+
image = image_generation_tool(promt)
|
| 108 |
+
return image
|
| 109 |
+
|
| 110 |
+
except Exception as e:
|
| 111 |
+
return f'We have some problem {e}'
|
| 112 |
# Import tool from Hub
|
| 113 |
+
#image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 114 |
|
| 115 |
with open("prompts.yaml", 'r') as stream:
|
| 116 |
prompt_templates = yaml.safe_load(stream)
|