- {
- "group_name": "General",
- "properties": [
- {
- "label": "Description",
- "name": "description",
- "value": "",
- "component": "string"
- {
- {
- "group_name": "Image Settings",
- "properties": [
- {
- "label": "Model",
- "name": "image_settings.model",
- "value": "",
- "component": "string"
- {
- "label": "FNumber",
- "name": "image_settings.f_number",
- "value": "",
- "component": "string"
- {
- "label": "ISOSpeedRatings",
- "name": "image_settings.iso_speed_ratings",
- "value": "",
- "component": "string"
- {
- "component": "slider",
- "label": "Schurn",
- "minimum": 0,
- "maximum": 1,
- "step": 0.01,
- "name": "image_settings.s_churn",
- "value": 0
- {
value: str | Image.Image | np.ndarray | Callable | None
value: str | Image.Image | np.ndarray | Callable | None
= None
A PIL Image, numpy array, path or URL for the default value that Image component is going to take. If a function is provided, the function will be called each time the app loads to set the initial value of this component.
format: str
format: str
= "webp"
File format (e.g. "png" or "gif"). Used to save image if it does not already have a valid format (e.g. if the image is being returned to the frontend as a numpy array or PIL Image). The format should be supported by the PIL library. Applies both when this component is used as an input or output. This parameter has no effect on SVG files.
height: int | str | None
height: int | str | None
= None
The height of the component, specified in pixels if a number is passed, or in CSS units if a string is passed. This has no effect on the preprocessed image file or numpy array, but will affect the displayed image.
width: int | str | None
width: int | str | None
= None
The width of the component, specified in pixels if a number is passed, or in CSS units if a string is passed. This has no effect on the preprocessed image file or numpy array, but will affect the displayed image.
image_mode: Literal[
"1",
"L",
"P",
"RGB",
"RGBA",
"CMYK",
"YCbCr",
"LAB",
"HSV",
"I",
"F",
]
| None
image_mode: Literal[
"1",
"L",
"P",
"RGB",
"RGBA",
"CMYK",
"YCbCr",
"LAB",
"HSV",
"I",
"F",
]
| None
= "RGB"
The pixel format and color depth that the image should be loaded and preprocessed as. "RGB" will load the image as a color image, or "L" as black-and-white. See https://pillow.readthedocs.io/en/stable/handbook/concepts.html for other supported image modes and their meaning. This parameter has no effect on SVG or GIF files. If set to None, the image_mode will be inferred from the image file type (e.g. "RGBA" for a .png image, "RGB" in most other cases).
type: Literal["numpy", "pil", "filepath"]
type: Literal["numpy", "pil", "filepath"]
= "numpy"
The format the image is converted before being passed into the prediction function. "numpy" converts the image to a numpy array with shape (height, width, 3) and values from 0 to 255, "pil" converts the image to a PIL image object, "filepath" passes a str path to a temporary file containing the image. To support animated GIFs in input, the `type` should be set to "filepath" or "pil". To support SVGs, the `type` should be set to "filepath".
label: str | I18nData | None
label: str | I18nData | None
= None
The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
every: Timer | float | None
every: Timer | float | None
= None
Continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
inputs: Component | Sequence[Component] | set[Component] | None
inputs: Component | Sequence[Component] | set[Component] | None
= None
Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change.
show_label: bool | None
show_label: bool | None
= None
If True, will display label.
show_download_button: bool
show_download_button: bool
= True
If True, will display button to download image. Only applies if interactive is False (e.g. if the component is used as an output).
container: bool
container: bool
= True
If True, will place the component in a container - providing some extra padding around the border.
scale: int | None
scale: int | None
= None
Relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.
min_width: int
min_width: int
= 160
Minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
interactive: bool | None
interactive: bool | None
= None
If True, will allow users to upload and edit an image; if False, can only be used to display images. If not provided, this is inferred based on whether the component is used as an input or output.
visible: bool
visible: bool
= True
If False, component will be hidden.
elem_id: str | None
elem_id: str | None
= None
An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
elem_classes: list[str] | str | None
elem_classes: list[str] | str | None
= None
An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
render: bool
render: bool
= True
If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
key: int | str | tuple[int | str, ...] | None
key: int | str | tuple[int | str, ...] | None
= None
In a gr.render, Components with the same key across re-renders are treated as the same component, not a new component. Properties set in 'preserved_by_key' are not reset across a re-render.
preserved_by_key: list[str] | str | None
preserved_by_key: list[str] | str | None
= "value"
A list of parameters from this component's constructor. Inside a gr.render() function, if a component is re-rendered with the same key, these (and only these) parameters will be preserved in the UI (if they have been changed by the user or an event listener) instead of re-rendered based on the values provided during constructor.
show_share_button: bool | None
show_share_button: bool | None
= None
If True, will show a share icon in the corner of the component that allows user to share outputs to Hugging Face Spaces Discussions. If False, icon does not appear. If set to None (default behavior), then the icon appears if this Gradio app is launched on Spaces, but not otherwise.
placeholder: str | None
placeholder: str | None
= None
Custom text for the upload area. Overrides default upload messages when provided. Accepts new lines and `#` to designate a heading.
show_fullscreen_button: bool
show_fullscreen_button: bool
= True
If True, will show a fullscreen icon in the corner of the component that allows user to view the image in fullscreen mode. If False, icon does not appear.
only_custom_metadata: bool
only_custom_metadata: bool
= True
If True, extracts only custom metadata, excluding technical metadata like ImageWidth or ImageHeight. Defaults to True.
disable_preprocess: bool
disable_preprocess: bool
= True
If True, skips preprocessing and returns the raw ImageMetaData payload. Defaults to True.
popup_metadata_width: int | str
popup_metadata_width: int | str
= 400
Metadata popup width in pixels or CSS units. Defaults to 400.
popup_metadata_height: int | str
popup_metadata_height: int | str
= 300
Metadata popup height in pixels or CSS units. Defaults to 300.
clear
clear
This listener is triggered when the user clears the ImageMeta using the clear button for the component.
change
change
Triggered when the value of the ImageMeta changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.
select
select
Event listener for when the user selects or deselects the ImageMeta. Uses event data gradio.SelectData to carry `value` referring to the label of the ImageMeta, and `selected` to refer to state of the ImageMeta. See EventData documentation on how to use this event data
upload
upload
This listener is triggered when the user uploads a file into the ImageMeta.
input
input
This listener is triggered when the user changes the value of the ImageMeta.
load_metadata
load_metadata
Triggered when the user clicks the 'Load Metadata' button, expecting ImageMetaData as input.