A TabbedInterface is created by providing a list of Interfaces or Blocks, each of which gets rendered in a separate tab.
Constructor
gr.TabbedInterface(
interface_list,
tab_names=None,
title=None,
analytics_enabled=None
)
Parameters
A list of Interfaces (or Blocks) to be rendered in the 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.
The tab title to display when this demo is opened in a browser window.
analytics_enabled
bool | None
default:"None"
Whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable or default to True.
Example
import gradio as gr
def classify(text):
return {"positive": 0.8, "negative": 0.2}
def translate(text):
return "Hola, " + text
interface1 = gr.Interface(fn=classify, inputs="text", outputs="label")
interface2 = gr.Interface(fn=translate, inputs="text", outputs="text")
demo = gr.TabbedInterface(
[interface1, interface2],
tab_names=["Classifier", "Translator"]
)
demo.launch()