Restoration of Gradio 4.x tab functionality for usage in TTS WebUI.
Python library for easily interacting with trained machine learning models
pip install gradio_goodtabimport gradio as gr
from gradio_goodtabs import GoodTabs
from gradio_goodtab import GoodTab as Tab
# gr.Tab = Tab
# gr.Tabs = GoodTabs
with gr.Blocks() as demo:
with gr.Row():
# with gr.Tabs():
with GoodTabs():
with Tab("Tab 1 long long long long long long long long long"):
gr.Textbox(value="foo", interactive=True)
with Tab("Tab 1 long long long long long long long long long"):
gr.Textbox(value="foo", interactive=True)
# with gr.Tab("Tab 1 long long long long long long long long long"):
# gr.Textbox(value="foo", interactive=True)
# with gr.Tab("Tab 1 long long long long long long long long long"):
# gr.Textbox(value="foo", interactive=True)
# with gr.Tab("Tab 1 long long long long long long long long long"):
# gr.Textbox(value="foo", interactive=True)
# with gr.Tab("Tab 1 long long long long long long long long long"):
# gr.Textbox(value="foo", interactive=True)
# with gr.Tab("Tab 2"):
# gr.Number(value=10, interactive=True)
if __name__ == "__main__":
demo.launch()| name | type | default | description |
|---|---|---|---|
label |
str | None |
None |
The visual label for the tab |
visible |
bool |
True |
If False, Tab will be hidden. |
interactive |
bool |
True |
If False, Tab will not be clickable. |
id |
int | str | None |
None |
An optional identifier for the tab, required if you wish to control the selected tab from a predict function. |
elem_id |
str | None |
None |
An optional string that is assigned as the id of the containing the contents of the Tab layout. The same string followed by "-button" is attached to the Tab button. Can be used for targeting CSS styles. |
elem_classes |
list[str] | str | None |
None |
An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles. |
render |
bool |
True |
If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later. |
| name | description |
|---|---|
select |
Event listener for when the user selects or deselects the GoodTab. Uses event data gradio.SelectData to carry value referring to the label of the GoodTab, and selected to refer to state of the GoodTab. See EventData documentation on how to use this event data |