Spaces:
Sleeping
Sleeping
Add code to check the tool's name and whether it can really produce the image
Browse files
app.py
CHANGED
|
@@ -52,7 +52,15 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
|
|
| 52 |
|
| 53 |
with open("prompts.yaml", 'r') as stream:
|
| 54 |
prompt_templates = yaml.safe_load(stream)
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
tools=[image_generation_tool,final_answer], ## add your tools here (don't remove final answer)
|
|
|
|
| 52 |
|
| 53 |
with open("prompts.yaml", 'r') as stream:
|
| 54 |
prompt_templates = yaml.safe_load(stream)
|
| 55 |
+
|
| 56 |
+
print("工具变量名: image_generation_tool")
|
| 57 |
+
print("工具实际 name:", image_generation_tool.name)
|
| 58 |
+
print("final_answer 的 name:", final_answer.name)
|
| 59 |
+
|
| 60 |
+
result = image_generation_tool("a cute cat avatar")
|
| 61 |
+
print(type(result))
|
| 62 |
+
print("raw size:", result.to_raw().size if hasattr(result, "to_raw") else "no to_raw")
|
| 63 |
+
|
| 64 |
agent = CodeAgent(
|
| 65 |
model=model,
|
| 66 |
tools=[image_generation_tool,final_answer], ## add your tools here (don't remove final answer)
|