Introducing Gradio Clients


New to Gradio? Start here: Getting Started

See the Release History


def hello(ยทยทยท):


The render decorator allows Gradio Blocks apps to have dynamic layouts, so that the components and event listeners in your app can change depending on custom logic. Attaching a @gr.render decorator to a function will cause the function to be re-run whenever the inputs are changed (or specified triggers are activated). The function contains the components and event listeners that will update based on the inputs.
The basic usage of @gr.render is as follows:
1. Create a function and attach the @gr.render decorator to it.
2. Add the input components to the inputs= argument of @gr.render, and create a corresponding argument in your function for each component.
3. Add all components inside the function that you want to update based on the inputs. Any event listeners that use these components should also be inside this function.

Example Usage

import gradio as gr

with gr.Blocks() as demo:
    input_text = gr.Textbox()

    def show_split(text):
        if len(text) == 0:
            gr.Markdown("## No Input Provided")
            for letter in text:
                with gr.Row():
                    text = gr.Textbox(letter)
                    btn = gr.Button("Clear")
           gr.Textbox(value=""), None, text)