vision-agent 0.2.192__py3-none-any.whl → 0.2.193__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vision_agent/tools/tools.py +22 -13
- {vision_agent-0.2.192.dist-info → vision_agent-0.2.193.dist-info}/METADATA +1 -1
- {vision_agent-0.2.192.dist-info → vision_agent-0.2.193.dist-info}/RECORD +5 -5
- {vision_agent-0.2.192.dist-info → vision_agent-0.2.193.dist-info}/LICENSE +0 -0
- {vision_agent-0.2.192.dist-info → vision_agent-0.2.193.dist-info}/WHEEL +0 -0
vision_agent/tools/tools.py
CHANGED
@@ -1798,24 +1798,33 @@ def flux_image_inpainting(
|
|
1798
1798
|
... )
|
1799
1799
|
>>> save_image(result, "inpainted_room.png")
|
1800
1800
|
"""
|
1801
|
-
if (
|
1802
|
-
image.shape[0] < 8
|
1803
|
-
or image.shape[1] < 8
|
1804
|
-
or mask.shape[0] < 8
|
1805
|
-
or mask.shape[1] < 8
|
1806
|
-
):
|
1807
|
-
raise ValueError("The image or mask does not have enough size for inpainting")
|
1808
1801
|
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1802
|
+
min_dim = 8
|
1803
|
+
|
1804
|
+
if any(dim < min_dim for dim in image.shape[:2] + mask.shape[:2]):
|
1805
|
+
raise ValueError(f"Image and mask must be at least {min_dim}x{min_dim} pixels")
|
1806
|
+
|
1807
|
+
max_size = (512, 512)
|
1808
|
+
|
1809
|
+
if image.shape[0] > max_size[0] or image.shape[1] > max_size[1]:
|
1810
|
+
scaling_factor = min(max_size[0] / image.shape[0], max_size[1] / image.shape[1])
|
1811
|
+
new_size = (
|
1812
|
+
int(image.shape[1] * scaling_factor),
|
1813
|
+
int(image.shape[0] * scaling_factor),
|
1814
|
+
)
|
1815
|
+
new_size = ((new_size[0] // 8) * 8, (new_size[1] // 8) * 8)
|
1816
|
+
image = cv2.resize(image, new_size, interpolation=cv2.INTER_AREA)
|
1817
|
+
mask = cv2.resize(mask, new_size, interpolation=cv2.INTER_NEAREST)
|
1818
|
+
|
1819
|
+
elif image.shape[0] % 8 != 0 or image.shape[1] % 8 != 0:
|
1820
|
+
new_size = ((image.shape[1] // 8) * 8, (image.shape[0] // 8) * 8)
|
1821
|
+
image = cv2.resize(image, new_size, interpolation=cv2.INTER_AREA)
|
1822
|
+
mask = cv2.resize(mask, new_size, interpolation=cv2.INTER_NEAREST)
|
1814
1823
|
|
1815
1824
|
if np.array_equal(mask, mask.astype(bool).astype(int)):
|
1816
1825
|
mask = np.where(mask > 0, 255, 0).astype(np.uint8)
|
1817
1826
|
else:
|
1818
|
-
raise ValueError("
|
1827
|
+
raise ValueError("Mask should contain only binary values (0 or 1)")
|
1819
1828
|
|
1820
1829
|
image_file = numpy_to_bytes(image)
|
1821
1830
|
mask_file = numpy_to_bytes(mask)
|
@@ -20,7 +20,7 @@ vision_agent/tools/__init__.py,sha256=UrpGFB1ACOZZCAyj8vNw0IHhKm9wGp0qHOtci2cqAM
|
|
20
20
|
vision_agent/tools/meta_tools.py,sha256=by7TIbH7lsLIayX_Pe2mS1iw8aeLn2T8yqAo8SkB9Kg,32074
|
21
21
|
vision_agent/tools/prompts.py,sha256=V1z4YJLXZuUl_iZ5rY0M5hHc_2tmMEUKr0WocXKGt4E,1430
|
22
22
|
vision_agent/tools/tool_utils.py,sha256=VPGqGJ2ZYEJA6AW7K9X7hQv6vRlMtAQcybE4izdToCw,8196
|
23
|
-
vision_agent/tools/tools.py,sha256
|
23
|
+
vision_agent/tools/tools.py,sha256=gV9z8jE38JVXhIMCwmBZU1TKM16KlwAk48ZBAV0t1w8,85728
|
24
24
|
vision_agent/tools/tools_types.py,sha256=8hYf2OZhI58gvf65KGaeGkt4EQ56nwLFqIQDPHioOBc,2339
|
25
25
|
vision_agent/utils/__init__.py,sha256=7fMgbZiEwbNS0fBOS_hJI5PuEYBblw36zLi_UjUzvj4,244
|
26
26
|
vision_agent/utils/exceptions.py,sha256=booSPSuoULF7OXRr_YbC4dtKt6gM_HyiFQHBuaW86C4,2052
|
@@ -29,7 +29,7 @@ vision_agent/utils/image_utils.py,sha256=rm9GfXvD4JrjnqKrP_f2gfq4SzmqYC0IdC1kKwd
|
|
29
29
|
vision_agent/utils/sim.py,sha256=ZuSS07TUXFGjipmiQoY8TKRmSes7XXCdtU9PI8PC1sw,5609
|
30
30
|
vision_agent/utils/type_defs.py,sha256=BE12s3JNQy36QvauXHjwyeffVh5enfcvd4vTzSwvEZI,1384
|
31
31
|
vision_agent/utils/video.py,sha256=tRcGp4vEnaDycigL1hBO9k0FBPtDH35fCQciVr9GqYI,6013
|
32
|
-
vision_agent-0.2.
|
33
|
-
vision_agent-0.2.
|
34
|
-
vision_agent-0.2.
|
35
|
-
vision_agent-0.2.
|
32
|
+
vision_agent-0.2.193.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
33
|
+
vision_agent-0.2.193.dist-info/METADATA,sha256=uDs9o-Lu4tU1jftsh-XQlcRJXyunc6VyPEoVAArGC7c,18067
|
34
|
+
vision_agent-0.2.193.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
35
|
+
vision_agent-0.2.193.dist-info/RECORD,,
|
File without changes
|
File without changes
|