Spaces:
Build error
Build error
Benedetto Scala commited on
Commit ·
c96a98f
1
Parent(s): d06fc3c
prova
Browse files
app.py
CHANGED
|
@@ -52,24 +52,14 @@ custom_role_conversions=None,
|
|
| 52 |
)
|
| 53 |
|
| 54 |
|
| 55 |
-
|
| 56 |
-
def image_generation_tool(prompt:str, token:str) -> str:
|
| 57 |
-
"""A tool that generates an image from a text prompt.
|
| 58 |
-
|
| 59 |
-
Args:
|
| 60 |
-
prompt: The text prompt to generate an image from.
|
| 61 |
-
token: The API token to use for the image generation tool.
|
| 62 |
-
"""
|
| 63 |
-
# Call the image generation tool with the provided prompt and API token
|
| 64 |
-
tool = load_tool("agents-course/text-to-image", trust_remote_code=True, token=token)
|
| 65 |
-
return tool(prompt=prompt)
|
| 66 |
|
| 67 |
with open("prompts.yaml", 'r') as stream:
|
| 68 |
prompt_templates = yaml.safe_load(stream)
|
| 69 |
|
| 70 |
agent = CodeAgent(
|
| 71 |
model=model,
|
| 72 |
-
tools=[final_answer,
|
| 73 |
max_steps=6,
|
| 74 |
verbosity_level=1,
|
| 75 |
grammar=None,
|
|
|
|
| 52 |
)
|
| 53 |
|
| 54 |
|
| 55 |
+
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True, token=token)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
with open("prompts.yaml", 'r') as stream:
|
| 58 |
prompt_templates = yaml.safe_load(stream)
|
| 59 |
|
| 60 |
agent = CodeAgent(
|
| 61 |
model=model,
|
| 62 |
+
tools=[final_answer, image_generation_tool], ## add your tools here (don't remove final answer)
|
| 63 |
max_steps=6,
|
| 64 |
verbosity_level=1,
|
| 65 |
grammar=None,
|