emmac commited on
Commit
924b42c
·
verified ·
1 Parent(s): 2e5a7d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -49,9 +49,6 @@ custom_role_conversions=None,
49
  # Import tool from Hub
50
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
51
 
52
- print("Image tool name:", image_generation_tool.name)
53
- print("Image tool:", image_generation_tool)
54
-
55
  with open("prompts.yaml", 'r') as stream:
56
  prompt_templates = yaml.safe_load(stream)
57
 
@@ -67,12 +64,17 @@ agent = CodeAgent(
67
  prompt_templates=prompt_templates
68
  )
69
 
70
- print("Agent tools (raw):", agent.tools)
71
- print("Agent tools (types):", [type(t) for t in agent.tools])
 
 
72
 
73
- for i, t in enumerate(agent.tools):
74
- name = getattr(t, "name", None)
75
- print(f"Tool {i}: type={type(t)} name={name} value={t}")
 
 
 
76
 
77
 
78
  GradioUI(agent).launch()
 
49
  # Import tool from Hub
50
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
51
 
 
 
 
52
  with open("prompts.yaml", 'r') as stream:
53
  prompt_templates = yaml.safe_load(stream)
54
 
 
64
  prompt_templates=prompt_templates
65
  )
66
 
67
+ img = image_generation_tool(prompt="A cute cat with prominent moustaches, photorealistic, high-resolution")
68
+
69
+ print("Returned type:", type(img))
70
+ print("Returned value:", img)
71
 
72
+ # If it's a PIL image, this will work:
73
+ try:
74
+ img.save("/tmp/test.png")
75
+ print("Saved to /tmp/test.png")
76
+ except Exception as e:
77
+ print("Could not save as PIL:", e)
78
 
79
 
80
  GradioUI(agent).launch()