vision-agent 0.2.183__tar.gz → 0.2.184__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. {vision_agent-0.2.183 → vision_agent-0.2.184}/PKG-INFO +1 -1
  2. {vision_agent-0.2.183 → vision_agent-0.2.184}/pyproject.toml +1 -1
  3. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/tools/__init__.py +1 -0
  4. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/tools/tools.py +76 -0
  5. {vision_agent-0.2.183 → vision_agent-0.2.184}/LICENSE +0 -0
  6. {vision_agent-0.2.183 → vision_agent-0.2.184}/README.md +0 -0
  7. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/__init__.py +0 -0
  8. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/__init__.py +0 -0
  9. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/agent.py +0 -0
  10. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/agent_utils.py +0 -0
  11. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/vision_agent.py +0 -0
  12. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/vision_agent_coder.py +0 -0
  13. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
  14. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/vision_agent_planner.py +0 -0
  15. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/vision_agent_planner_prompts.py +0 -0
  16. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/agent/vision_agent_prompts.py +0 -0
  17. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/clients/__init__.py +0 -0
  18. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/clients/http.py +0 -0
  19. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/clients/landing_public_api.py +0 -0
  20. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/fonts/__init__.py +0 -0
  21. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
  22. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/lmm/__init__.py +0 -0
  23. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/lmm/lmm.py +0 -0
  24. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/lmm/types.py +0 -0
  25. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/tools/meta_tools.py +0 -0
  26. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/tools/prompts.py +0 -0
  27. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/tools/tool_utils.py +0 -0
  28. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/tools/tools_types.py +0 -0
  29. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/utils/__init__.py +0 -0
  30. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/utils/exceptions.py +0 -0
  31. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/utils/execute.py +0 -0
  32. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/utils/image_utils.py +0 -0
  33. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/utils/sim.py +0 -0
  34. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/utils/type_defs.py +0 -0
  35. {vision_agent-0.2.183 → vision_agent-0.2.184}/vision_agent/utils/video.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vision-agent
3
- Version: 0.2.183
3
+ Version: 0.2.184
4
4
  Summary: Toolset for Vision Agent
5
5
  Author: Landing AI
6
6
  Author-email: dev@landing.ai
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "vision-agent"
7
- version = "0.2.183"
7
+ version = "0.2.184"
8
8
  description = "Toolset for Vision Agent"
9
9
  authors = ["Landing AI <dev@landing.ai>"]
10
10
  readme = "README.md"
@@ -68,6 +68,7 @@ from .tools import (
68
68
  qwen2_vl_images_vqa,
69
69
  qwen2_vl_video_vqa,
70
70
  video_temporal_localization,
71
+ flux_image_inpainting,
71
72
  )
72
73
 
73
74
  __new_tools__ = [
@@ -1773,6 +1773,82 @@ def closest_box_distance(
1773
1773
  return cast(float, np.sqrt(horizontal_distance**2 + vertical_distance**2))
1774
1774
 
1775
1775
 
1776
+ def flux_image_inpainting(
1777
+ prompt: str,
1778
+ image: np.ndarray,
1779
+ mask: np.ndarray,
1780
+ ) -> np.ndarray:
1781
+ """'flux_image_inpainting' performs image inpainting to fill the masked regions,
1782
+ given by mask, in the image, given image based on the text prompt and surrounding image context.
1783
+ It can be used to edit regions of an image according to the prompt given.
1784
+
1785
+ Parameters:
1786
+ prompt (str): A detailed text description guiding what should be generated
1787
+ in the masked area. More detailed and specific prompts typically yield better results.
1788
+ image (np.ndarray): The source image to be inpainted.
1789
+ The image will serve as the base context for the inpainting process.
1790
+ mask (np.ndarray): A binary mask image with 0's and 1's,
1791
+ where 1 indicates areas to be inpainted and 0 indicates areas to be preserved.
1792
+
1793
+ Returns:
1794
+ np.ndarray:
1795
+ The generated image(s) as a numpy array in RGB format
1796
+ with values ranging from 0 to 255.
1797
+
1798
+ -------
1799
+ Example:
1800
+ >>> # Generate inpainting
1801
+ >>> result = flux_image_inpainting(
1802
+ ... prompt="a modern black leather sofa with white pillows",
1803
+ ... image=image,
1804
+ ... mask=mask,
1805
+ ... )
1806
+ >>> save_image(result, "inpainted_room.png")
1807
+ """
1808
+ if (
1809
+ image.shape[0] < 8
1810
+ or image.shape[1] < 8
1811
+ or mask.shape[0] < 8
1812
+ or mask.shape[1] < 8
1813
+ ):
1814
+ raise ValueError("The image or mask does not have enough size for inpainting")
1815
+
1816
+ if np.array_equal(mask, mask.astype(bool).astype(int)):
1817
+ mask = np.where(mask > 0, 255, 0).astype(np.uint8)
1818
+ else:
1819
+ raise ValueError("The mask should be a binary mask with 0's and 1's")
1820
+
1821
+ image_file = numpy_to_bytes(image)
1822
+ mask_file = numpy_to_bytes(mask)
1823
+
1824
+ files = [
1825
+ ("image", image_file),
1826
+ ("mask_image", mask_file),
1827
+ ]
1828
+
1829
+ payload = {
1830
+ "prompt": prompt,
1831
+ "task": "inpainting",
1832
+ "height": image.shape[0],
1833
+ "width": image.shape[1],
1834
+ "strength": 0.99,
1835
+ "guidance_scale": 18,
1836
+ "num_inference_steps": 20,
1837
+ "seed": None,
1838
+ }
1839
+
1840
+ response = send_inference_request(
1841
+ payload=payload,
1842
+ endpoint_name="flux1",
1843
+ files=files,
1844
+ v2=True,
1845
+ metadata_payload={"function_name": "flux_image_inpainting"},
1846
+ )
1847
+
1848
+ output_image = np.array(b64_to_pil(response[0]).convert("RGB"))
1849
+ return output_image
1850
+
1851
+
1776
1852
  # Utility and visualization functions
1777
1853
 
1778
1854
 
File without changes
File without changes