text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 189
values | source_page_title stringclasses 189
values |
|---|---|---|---|
sentence_builderslider_releaseinterface_random_sliderblocks_random_slider
| Demos | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The Slider component supports the following... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
| None
default `= None`
List of gradio.components to use as outputs. If the function returns no
outputs, this should be an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or None. If
set to a string, the endpoint will be exposed in ... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
ol
default `= False`
If True, then the function should process a batch of inputs, meaning that it
should accept a list of input values for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*required* to return a tuple of lists (even if there is only 1 out... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
plete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method to run before running 'fn'. Input arguments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
n before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()` for each input value.
| Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Thread-safe cache with manual get/set control, injected as a function
parameter (add as a default parameter value and Gradio will inject it
automatically). Supports per-session isolation so cached data doesn't leak
between users, content-aware hashing for ML types (numpy, PIL, pandas), and
LRU eviction with memory limi... | Description | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
import gradio as gr
def generate(prompt, c=gr.Cache(per_session=True)):
hit = c.get(prompt)
if hit is not None:
return hit["result"]
result = llm(prompt)
c.set(prompt, result=result)
return result
| Example Usage | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
Parameters ▼
max_size: int
default `= 128`
max_memory: str | int | None
default `= None`
per_session: bool
default `= False`
| Initialization | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
Methods | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs | |
%20Copyright%202022%20Fonticons,%20Inc.... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2039... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2039... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
Creates a component with arbitrary HTML. Can include CSS and JavaScript to
create highly customized and interactive components.
| Description | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
**Using HTML as an input component.**
How HTML will pass its value to your function:
Type: `str | None`
(Rarely used) passes the HTML as a `str`.
Example Code
import gradio as gr
def predict(
value: str | None
):
process value from the HTML co... | Behavior | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
Parameters ▼
value: Any | Callable | None
default `= None`
The HTML content in the ${value} tag in the html_template. For example, if
html_template="<p>${value}</p>" and value="Hello, world!", the component will
render as `"<p>Hello, world!</p>"`.
label: str | I18nData | None
default ... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
()`. The `trigger` function can be used to trigger
events, such as `trigger('click')`. The value and other props can be edited
through `props`, e.g. `props.value = "new value"` which will re-render the
HTML template. If `server_functions` is provided, a `server` object is also
available in `js_on_load`, where each func... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
.
scale: int | None
default `= 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=T... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
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.
min_height: in... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
d for `<script>` and `<link>` tags to load third-party
libraries. Scripts are deduplicated by `src` and links by `href`, so multiple
components requiring the same library won't load it twice.
server_functions: list[Callable] | None
default `= None`
A list of Python functions that can be called from `j... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
Shortcuts
gradio.HTML
Interface String Shortcut `"html"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
super_html
| Demos | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The HTML component supports the following e... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
, ···)
This listener is triggered when the user reaches the end of the media playing
in the HTML.
HTML.start_recording(fn, ···)
This listener is triggered when the user starts recording with the HTML.
HTML.pause_recording(fn, ···)
This listener is triggered when the user pauses recordin... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
ta.index and SelectData.value. See
SelectData documentation on how to use this event data.
HTML.option_select(fn, ···)
This listener is triggered when the user clicks on an option from within the
HTML. This event has SelectData of type gradio.SelectData that carries
information, accessible through Selec... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
e
as a FileData object. See EventData documentation on how to use this event
data
HTML.copy(fn, ···)
This listener is triggered when the user copies content from the HTML. Uses
event data gradio.CopyData to carry information about the copied content. See
EventData documentation on how to use this event ... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
he function's docstring will be used as the API
endpoint description. If False, then no description will be displayed in the
API docs.
scroll_to_output: bool
default `= False`
If True, will scroll to output component on completion
show_progress: Literal['full', 'minimal', 'hidden']
de... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
g 'fn'
(e.g. leaving it as a base64 string if this method is called with the `Image`
component).
postprocess: bool
default `= True`
If False, will not run postprocessing of component data before returning 'fn'
output to the browser.
cancels: dict[str, Any] | list[dict[str, Any]] | None... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
1 by default).
concurrency_id: str | None
default `= None`
If set, this is the id of the concurrency group. Events with the same
concurrency_id will be limited by the lowest set concurrency_limit.
api_visibility: Literal['public', 'private', 'undocumented']
default `= "public"`
contr... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
Creates a set of (string or numeric type) radio buttons of which only one
can be selected.
| Description | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
**Using Radio as an input component.**
How Radio will pass its value to your function:
Type: `str | int | float | None`
Passes the value of the selected radio button as a `str | int | float`, or its index as an `int` into the function, depending on `type`.
Example Code
import gradio as g... | Behavior | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
Parameters ▼
choices: list[str | int | float | tuple[str | I18nData, str | int | float]] | None
default `= None`
A list of string or numeric options to select from. An option can also be a
tuple of the form (name, value), where name is the displayed name of the radio
button and value is the value to b... | Initialization | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
`value` if `value` is a
function (has no effect otherwise). `value` is recalculated any time the
inputs change.
show_label: bool | None
default `= None`
if True, will display label.
container: bool
default `= True`
If True, will place the component in a container - providing some ext... | Initialization | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
ks 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
default `= None`
in a gr.render, Components with the same key across re-renders are treated as
the same component, not a new component. Properties ... | Initialization | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
Shortcuts
gradio.Radio
Interface String Shortcut `"radio"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
sentence_builderblocks_essay
| Demos | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The Radio component supports the following ... | Event Listeners | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
e as inputs. If the function takes no inputs,
this should be an empty list.
outputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as outputs. If the function returns no
outputs, this should be an empt... | Event Listeners | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
he queue has been enabled.
If False, will not put this event on the queue, even if the queue has been
enabled. If None, will use the queue setting of the gradio app.
batch: bool
default `= False`
If True, then the function should process a batch of inputs, meaning that it
should accept a list of input... | Event Listeners | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
"multiple", unlimited
submissions are allowed while pending, and "always_last" (default for
`.change()` and `.key_up()` events) would allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method to run before running 'fn'. ... | Event Listeners | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
set, this
value identifies an event as identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successf... | Event Listeners | https://gradio.app/docs/gradio/radio | Gradio - Radio Docs |
Displays an interactive table of parameters and their descriptions and
default values with syntax highlighting. For each parameter, the user should
provide a type (e.g. a `str`), a human-readable description, and a default
value. As this component does not accept user input, it is rarely used as an
input component. Int... | Description | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
**Using ParamViewer as an input component.**
How ParamViewer will pass its value to your function:
Type: `dict[str, Parameter]`
(Rarely used) passes value as a `dict[str, dict]`. The key in the outer
dictionary is the parameter name, while the inner dictionary has keys "type",
"description", and "default" for each p... | Behavior | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
Parameters ▼
value: dict[str, Parameter] | None
default `= None`
A dictionary of dictionaries. The key in the outer dictionary is the parameter
name, while the inner dictionary has keys "type", "description", and "default"
for each parameter. Markdown links are supported in "description".
... | Initialization | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
der()
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.
header: str | None
default `= "Parameters"`... | Initialization | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
Shortcuts
gradio.ParamViewer
Interface String Shortcut `"paramviewer"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The ParamViewer component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
rns no
outputs, this should be an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or None. If
set to a string, the endpoint will be exposed in the API docs with the given
name. If None (default), the name of the function will be used ... | Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
that it
should accept a list of input values for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*required* to return a tuple of lists (even if there is only 1 output
component), with each list in the tuple corresponding to one output component.
... | Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
js method to run before running 'fn'. Input arguments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum number of this event that can be runni... | Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
lse, and only if it
completes successfully will the main function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()` for each input value.
[Documenting Custom Components](../../guides/documenting-custom-components/)
| Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
The Progress class provides a custom progress tracker that is used in a
function signature. To attach a Progress tracker to a function, simply add a
parameter right after the input parameters that has a default value set to a
`gradio.Progress()` instance. The Progress tracker can then be updated in the
function by call... | Description | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
import gradio as gr
import time
def my_function(x, progress=gr.Progress()):
progress(0, desc="Starting...")
time.sleep(1)
for i in progress.tqdm(range(100)):
time.sleep(0.1)
return x
gr.Interface(my_function, gr.Textbox(), gr.Textbox()).queue().launch()
| Example Usage | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
Parameters ▼
track_tqdm: bool
default `= False`
If True, the Progress object will track any tqdm.tqdm iterations with the tqdm
library in the function.
| Initialization | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
Methods | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs | |
%20Copyright%202022%20Fonticons,%20Inc.... | __call__ | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260... | __call__ | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
None if unknown. If None, hides progress bar.
desc: str | None
default `= None`
description to display.
total: int | float | None
default `= None`
estimated total number of steps.
unit: str
default `= "steps"`
unit of iterations.
| __call__ | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | tqdm | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
2'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2... | tqdm | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
total number of steps.
unit: str
default `= "steps"`
unit of iterations.
[Progress Bars](../../guides/progress-bars/)
| tqdm | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | __call__ | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260... | __call__ | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
None if unknown. If None, hides progress bar.
desc: str | None
default `= None`
description to display.
total: int | float | None
default `= None`
estimated total number of steps.
unit: str
default `= "steps"`
unit of iterations.
| __call__ | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | tqdm | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
2'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2... | tqdm | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
total number of steps.
unit: str
default `= "steps"`
unit of iterations.
| tqdm | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
Creates an image component that can be used to upload images (as an input)
or display images (as an output).
| Description | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
**Using SimpleImage as an input component.**
How SimpleImage will pass its value to your function:
Type: `str | None`
A `str` containing the path to the image.
Example Code
import gradio as gr
def predict(
value: str | None
):
process value fr... | Behavior | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Parameters ▼
value: str | None
default `= None`
A path or URL for the default value that SimpleImage 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.
label: str | I18nData | None
defa... | Initialization | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
ill_height=True.
min_width: int
default `= 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 | No... | Initialization | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
t 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.
| Initialization | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Shortcuts
gradio.SimpleImage
Interface String Shortcut `"simpleimage"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The SimpleImage component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as outputs. If the function returns no
outputs, this should be an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or ... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
queue setting of the gradio app.
batch: bool
default `= False`
If True, then the function should process a batch of inputs, meaning that it
should accept a list of input values for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*require... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
d allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method to run before running 'fn'. Input arguments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Constructs a Gradio app automatically from a Hugging Face model/Space repo
name or a 3rd-party API provider. Note that if a Space repo is loaded, certain
high-level attributes of the Blocks (e.g. custom `css`, `js`, and `head`
attributes) will not be loaded.
| Description | https://gradio.app/docs/gradio/load | Gradio - Load Docs |
import gradio as gr
demo = gr.load("gradio/question-answering", src="spaces")
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/load | Gradio - Load Docs |
Parameters ▼
name: str
the name of the model (e.g. "google/vit-base-patch16-224") or Space (e.g.
"flax-community/spanish-gpt2"). This is the first parameter passed into the
`src` function. Can also be formatted as {src}/{repo name} (e.g.
"models/google/vit-base-patch16-224") if `src` is not provided.
... | Initialization | https://gradio.app/docs/gradio/load | Gradio - Load Docs |
DER_T | None
default `= None`
the name of the third-party (non-Hugging Face) providers to use for model
inference (e.g. "replicate", "sambanova", "fal-ai", etc). Should be one of the
providers supported by `huggingface_hub.InferenceClient`. This parameter is
only used when `src` is "models"
kwargs: <c... | Initialization | https://gradio.app/docs/gradio/load | Gradio - Load Docs |
Used to display arbitrary JSON output prettily. As this component does not
accept user input, it is rarely used as an input component.
| Description | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
**Using JSON as an input component.**
How JSON will pass its value to your function:
Type: `dict | list | None`
Passes the JSON value as a `dict` or `list` depending on the value.
Example Code
import gradio as gr
def predict(
value: dict | list | None
):
... | Behavior | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
Parameters ▼
value: str | dict | list | Callable | None
default `= None`
Default value as a valid JSON `str` -- or a `list` or `dict` that can be
serialized to a JSON string. If a function is provided, the function will be
called each time the app loads to set the initial value of this component.
... | Initialization | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
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.
visible: bool | Literal['hidden']
default `= True`
If False, component will be hidden. If "hidden", component wi... | Initialization | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
e
levels deeper than 3 are collapsed.
show_indices: bool
default `= False`
Whether to show numerical indices when displaying the elements of a list
within the JSON object.
height: int | str | None
default `= None`
Height of the JSON component in pixels if a number is passed, or in CS... | Initialization | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.