Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,10 @@ def create_new_vday_card_tool(theme:str) -> str: #it's import to specify the ret
|
|
| 16 |
theme: A string representing the theme for the Valentine's Day card.
|
| 17 |
"""
|
| 18 |
try:
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
return final_answer(image)
|
| 21 |
except Exception as e:
|
| 22 |
return f"Error creating image for theme '{theme}': {str(e)}"
|
|
@@ -50,17 +53,12 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may
|
|
| 50 |
custom_role_conversions=None,
|
| 51 |
)
|
| 52 |
|
| 53 |
-
|
| 54 |
-
# Import tool from Hub
|
| 55 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 56 |
-
|
| 57 |
-
|
| 58 |
with open("prompts.yaml", 'r') as stream:
|
| 59 |
prompt_templates = yaml.safe_load(stream)
|
| 60 |
|
| 61 |
agent = CodeAgent(
|
| 62 |
model=model,
|
| 63 |
-
tools=[final_answer, create_new_vday_card_tool
|
| 64 |
max_steps=6,
|
| 65 |
verbosity_level=1,
|
| 66 |
grammar=None,
|
|
|
|
| 16 |
theme: A string representing the theme for the Valentine's Day card.
|
| 17 |
"""
|
| 18 |
try:
|
| 19 |
+
# Import tool from Hub
|
| 20 |
+
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 21 |
+
prompt = "A high-resolution image of a valentine's day card themed around " + theme
|
| 22 |
+
image = image_generation_tool(prompt)
|
| 23 |
return final_answer(image)
|
| 24 |
except Exception as e:
|
| 25 |
return f"Error creating image for theme '{theme}': {str(e)}"
|
|
|
|
| 53 |
custom_role_conversions=None,
|
| 54 |
)
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
with open("prompts.yaml", 'r') as stream:
|
| 57 |
prompt_templates = yaml.safe_load(stream)
|
| 58 |
|
| 59 |
agent = CodeAgent(
|
| 60 |
model=model,
|
| 61 |
+
tools=[final_answer, create_new_vday_card_tool], # add your tools here (don't remove final answer)
|
| 62 |
max_steps=6,
|
| 63 |
verbosity_level=1,
|
| 64 |
grammar=None,
|