Introducing Gradio 5.0
Read MoreIntroducing Gradio 5.0
Read MoreNew to Gradio? Start here: Getting Started
See the Release History
To install Gradio from main, run the following command:
pip install https://gradio-builds.s3.amazonaws.com/69acfebffd0d3479a40352de19c8763863557428/gradio-5.4.0-py3-none-any.whl
*Note: Setting share=True
in
launch()
will not work.
@gr.render(inputs=···)
def hello(···):
...
inputs=
argument of @gr.render, and create a corresponding argument in your function for each component. import gradio as gr
with gr.Blocks() as demo:
input_text = gr.Textbox()
@gr.render(inputs=input_text)
def show_split(text):
if len(text) == 0:
gr.Markdown("## No Input Provided")
else:
for letter in text:
with gr.Row():
text = gr.Textbox(letter)
btn = gr.Button("Clear")
btn.click(lambda: gr.Textbox(value=""), None, text)
inputs: list[Component] | Component | None
= None
List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
triggers: list[EventListenerCallable] | EventListenerCallable | None
= None
List of triggers to listen to, e.g. [btn.click, number.change]. If None, will listen to changes to any inputs.
queue: bool
= True
If True, will place the request on the queue, if the 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.
trigger_mode: Literal['once', 'multiple', 'always_last'] | None
= "always_last"
If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "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.
concurrency_limit: int | None | Literal['default']
= None
If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
concurrency_id: str | None
= 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.