Spaces:
Sleeping
Sleeping
Import a different image generation tool
Browse files
app.py
CHANGED
@@ -49,14 +49,21 @@ custom_role_conversions=None,
|
|
49 |
|
50 |
|
51 |
# Import tool from Hub
|
52 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
with open("prompts.yaml", 'r') as stream:
|
55 |
prompt_templates = yaml.safe_load(stream)
|
56 |
|
57 |
agent = CodeAgent(
|
58 |
model=model,
|
59 |
-
tools=[final_answer, image_generation_tool], ## add your tools here (don't remove final answer)
|
60 |
max_steps=6,
|
61 |
verbosity_level=1,
|
62 |
grammar=None,
|
|
|
49 |
|
50 |
|
51 |
# Import tool from Hub
|
52 |
+
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
53 |
+
|
54 |
+
# Import the image generation tool directly from the Space
|
55 |
+
image_generation_tool = Tool.from_space(
|
56 |
+
"black-forest-labs/FLUX.1-schnell",
|
57 |
+
name="image_generator",
|
58 |
+
description="Generate an image from a text prompt. The prompt should be detailed to create high-quality images."
|
59 |
+
)
|
60 |
|
61 |
with open("prompts.yaml", 'r') as stream:
|
62 |
prompt_templates = yaml.safe_load(stream)
|
63 |
|
64 |
agent = CodeAgent(
|
65 |
model=model,
|
66 |
+
tools=[final_answer, image_generation_tool, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
67 |
max_steps=6,
|
68 |
verbosity_level=1,
|
69 |
grammar=None,
|