mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
Add title to TabbedInterface
(#2888)
* Add title to `TabbedInterface` * Add title to the header of interface * Add the new title feature to changelog
This commit is contained in:
parent
88c9206159
commit
21820f47ab
@ -1,7 +1,7 @@
|
||||
# Upcoming Release
|
||||
|
||||
## New Features:
|
||||
No changes to highlight.
|
||||
* Added `title` argument to `TabbedInterface` by @MohamedAliRashad in [#2888](https://github.com/gradio-app/gradio/pull/2888)
|
||||
|
||||
## Bug Fixes:
|
||||
* Fixed bug where setting `default_enabled=False` made it so that the entire queue did not start by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 2876](https://github.com/gradio-app/gradio/pull/2876)
|
||||
|
@ -726,6 +726,7 @@ class TabbedInterface(Blocks):
|
||||
self,
|
||||
interface_list: List[Interface],
|
||||
tab_names: Optional[List[str]] = None,
|
||||
title: Optional[str] = None,
|
||||
theme: str = "default",
|
||||
analytics_enabled: Optional[bool] = None,
|
||||
css: Optional[str] = None,
|
||||
@ -734,6 +735,7 @@ class TabbedInterface(Blocks):
|
||||
Parameters:
|
||||
interface_list: a list of interfaces to be rendered in tabs.
|
||||
tab_names: a list of tab names. If None, the tab names will be "Tab 1", "Tab 2", etc.
|
||||
title: 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: which theme to use - right now, only "default" is supported.
|
||||
analytics_enabled: whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable or default to True.
|
||||
css: custom css or path to custom css file to apply to entire Blocks
|
||||
@ -741,6 +743,7 @@ class TabbedInterface(Blocks):
|
||||
a Gradio Tabbed Interface for the given interfaces
|
||||
"""
|
||||
super().__init__(
|
||||
title=title,
|
||||
theme=theme,
|
||||
analytics_enabled=analytics_enabled,
|
||||
mode="tabbed_interface",
|
||||
@ -749,6 +752,12 @@ class TabbedInterface(Blocks):
|
||||
if tab_names is None:
|
||||
tab_names = ["Tab {}".format(i) for i in range(len(interface_list))]
|
||||
with self:
|
||||
if title:
|
||||
Markdown(
|
||||
"<h1 style='text-align: center; margin-bottom: 1rem'>"
|
||||
+ title
|
||||
+ "</h1>"
|
||||
)
|
||||
with Tabs():
|
||||
for (interface, tab_name) in zip(interface_list, tab_names):
|
||||
with TabItem(label=tab_name):
|
||||
|
Loading…
Reference in New Issue
Block a user