What's New in Gradio 4.0?

Watch

Custom ComponentsNEW

Guides

New to Gradio? Start here: Getting Started

See the Release History

TabbedInterface

gradio.TabbedInterface(interface_list, ···)

Description

A TabbedInterface is created by providing a list of Interfaces, each of which gets rendered in a separate tab.

Initialization

Parameter Description
interface_list

list[Interface]

required

a list of interfaces to be rendered in tabs.

tab_names

list[str] | None

default: None

a list of tab names. If None, the tab names will be "Tab 1", "Tab 2", etc.

title

str | None

default: None

a title for the interface; if provided, appears above the input and output components in large font. Also used as the tab title when opened in a browser window.

theme

Theme | None

default: None

analytics_enabled

bool | None

default: None

whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable or default to True.

css

str | None

default: None

custom css or path to custom css file to apply to entire Blocks

Demos

import gradio as gr

tts_examples = [
    "I love learning machine learning",
    "How do you do?",
]

tts_demo = gr.load(
    "huggingface/facebook/fastspeech2-en-ljspeech",
    title=None,
    examples=tts_examples,
    description="Give me something to say!",
    cache_examples=False
)

stt_demo = gr.load(
    "huggingface/facebook/wav2vec2-base-960h",
    title=None,
    inputs="mic",
    description="Let me try to guess what you're saying!",
)

demo = gr.TabbedInterface([tts_demo, stt_demo], ["Text-to-speech", "Speech-to-text"])

if __name__ == "__main__":
    demo.launch()