fal.toolkit.image package¶
Subpackages¶
Submodules¶
fal.toolkit.image.image module¶
- class fal.toolkit.image.image.Image(**data)¶
Bases:
File
Represents an image file.
- content_type: Optional[str]¶
- file_data: Optional[bytes]¶
- file_name: Optional[str]¶
- file_size: Optional[int]¶
- classmethod from_bytes(data, format, size=None, file_name=None, repository='fal_v3', fallback_repository=['cdn', 'fal'], request=None)¶
- Return type:
- classmethod from_pil(pil_image, format=None, file_name=None, repository='fal_v3', fallback_repository=['cdn', 'fal'], request=None)¶
- Return type:
- height: Optional[int]¶
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'ui': {'field': 'image'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_pil(mode='RGB')¶
- Return type:
Image
- url: str¶
- width: Optional[int]¶
fal.toolkit.image.safety_checker module¶
- fal.toolkit.image.safety_checker.load_safety_checker()¶
- fal.toolkit.image.safety_checker.postprocess_images(pil_images, enable_safety_checker=True, safety_checker_version=2)¶
- Return type:
dict
[str
,Any
]
- fal.toolkit.image.safety_checker.run_safety_checker(pil_images)¶
- Return type:
list
[bool
]
- fal.toolkit.image.safety_checker.run_safety_checker_v2(pil_images, nsfw_threshold=0.5)¶
- Return type:
list
[bool
]
Module contents¶
- fal.toolkit.image.filter_by(has_nsfw_concepts, images)¶
- Return type:
list
[Image
]
- fal.toolkit.image.preprocess_image(image_pil, convert_to_rgb=True, fix_orientation=True)¶
- fal.toolkit.image.read_image_from_url(url, convert_to_rgb=True, fix_orientation=True)¶