Introducing Gradio Clients

Watch

New to Gradio? Start here: Getting Started

See the Release History

Markdown

gradio.Markdown(ยทยทยท)
import gradio as gr with gr.Blocks() as demo: with gr.Group(): gr.Markdown(value="This _example_ was **written** in [Markdown](https://en.wikipedia.org/wiki/Markdown)\n") demo.launch()

Description

Used to render arbitrary Markdown output. Can also render latex enclosed by dollar signs. As this component does not accept user input, it is rarely used as an input component.

Behavior

As input component: Passes the str of Markdown corresponding to the displayed value.

Your function should accept one of these types:
def predict(
	value: str | None
)
	...

As output component: Expects a valid str that can be rendered as Markdown.

Your function should return one of these types:
def predict(ยทยทยท) -> str | None
	...	
	return value

Initialization

Parameters

Shortcuts

Class Interface String Shortcut Initialization

gradio.Markdown

"markdown"

Uses default values

Demos

import gradio as gr def welcome(name): return f"Welcome to Gradio, {name}!" with gr.Blocks() as demo: gr.Markdown( """ # Hello World! Start typing below to see the output. """) inp = gr.Textbox(placeholder="What is your name?") out = gr.Textbox() inp.change(welcome, inp, out) if __name__ == "__main__": demo.launch()

Event Listeners

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 Markdown component supports the following event listeners. Each event listener takes the same parameters, which are listed in the Event Parameters table below.

Listener Description

Markdown.change(fn, ยทยทยท)

Triggered when the value of the Markdown 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.

Event Parameters

Parameters

Guides