-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
254 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Menu | ||
|
||
A versatile menu for navigation. See [Ant Design](https://ant.design/components/menu/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Menu | ||
|
||
A versatile menu for navigation. See [Ant Design](https://ant.design/components/menu/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from helper.Docs import Docs | ||
|
||
docs = Docs(__file__) | ||
|
||
if __name__ == "__main__": | ||
docs.render().queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import gradio as gr | ||
|
||
import modelscope_studio.components.antd as antd | ||
import modelscope_studio.components.base as ms | ||
|
||
default_mode = 'horizontal' | ||
|
||
with gr.Blocks() as demo: | ||
with ms.Application(): | ||
with antd.ConfigProvider(): | ||
mode_select = antd.Select(value=default_mode, | ||
options=[{ | ||
"label": "horizontal", | ||
"value": "horizontal" | ||
}, { | ||
"label": "inline", | ||
"value": "inline" | ||
}, { | ||
"label": "vertical", | ||
"value": "vertical" | ||
}], | ||
elem_style=dict(width=200)) | ||
inline_collapsed_switch = antd.Switch( | ||
False, | ||
checked_children="Inline Collapsed", | ||
un_checked_children="Inline Expanded") | ||
with antd.Menu(selected_keys=[default_mode], | ||
mode="horizontal") as menu: | ||
with antd.Menu.Item(key="mail", label="Navigation One"): | ||
with ms.Slot("icon"): | ||
antd.Icon("MailOutlined") | ||
with antd.Menu.Item(key="app", | ||
label="Navigation Two", | ||
disabled=True): | ||
with ms.Slot("icon"): | ||
antd.Icon("AppstoreOutlined") | ||
with antd.Menu.Item(key="SubMenu", | ||
label="Navigation Three - Submenu"): | ||
with ms.Slot("icon"): | ||
antd.Icon("SettingOutlined") | ||
with antd.Menu.Item(type="group", label="Item 1"): | ||
antd.Menu.Item(label="Option 1", key="setting:1") | ||
antd.Menu.Item(label="Option 2", key="setting:2") | ||
with antd.Menu.Item(type="group", label="Item 2"): | ||
antd.Menu.Item(label="Option 3", key="setting:3") | ||
antd.Menu.Item(label="Option 4", key="setting:4") | ||
with antd.Menu.Item(key="modelscope", | ||
label="Navigation Four - Link"): | ||
with ms.Slot("label"): | ||
antd.Button("Navigation Four - Link", | ||
type="link", | ||
href="https://modelscope.cn", | ||
href_target="_blank") | ||
mode_select.change( | ||
fn=lambda _mode_select: gr.update(mode=_mode_select), | ||
inputs=[mode_select], | ||
outputs=[menu]) | ||
inline_collapsed_switch.change( | ||
fn=lambda _inline_collapsed_switch: gr.update( | ||
inline_collapsed=_inline_collapsed_switch), | ||
inputs=[inline_collapsed_switch], | ||
outputs=[menu]) | ||
if __name__ == "__main__": | ||
demo.queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Pagination | ||
|
||
A long list can be divided into several pages, and only one page will be loaded at a time. See [Ant Design](https://ant.design/components/pagination/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Pagination | ||
|
||
A long list can be divided into several pages, and only one page will be loaded at a time. See [Ant Design](https://ant.design/components/pagination/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from helper.Docs import Docs | ||
|
||
docs = Docs(__file__) | ||
|
||
if __name__ == "__main__": | ||
docs.render().queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import gradio as gr | ||
|
||
import modelscope_studio.components.antd as antd | ||
import modelscope_studio.components.base as ms | ||
|
||
with gr.Blocks() as demo: | ||
with ms.Application(): | ||
with antd.ConfigProvider(): | ||
antd.Pagination(total=85, | ||
show_quick_jumper=True, | ||
show_size_changer=True, | ||
show_total="(total) => `Total ${total} items``") | ||
|
||
if __name__ == "__main__": | ||
demo.queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Steps | ||
|
||
A navigation bar that guides users through the steps of a task. See [Ant Design](https://ant.design/components/steps/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Steps | ||
|
||
A navigation bar that guides users through the steps of a task. See [Ant Design](https://ant.design/components/steps/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from helper.Docs import Docs | ||
|
||
docs = Docs(__file__) | ||
|
||
if __name__ == "__main__": | ||
docs.render().queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import gradio as gr | ||
|
||
import modelscope_studio.components.antd as antd | ||
import modelscope_studio.components.base as ms | ||
|
||
description = "This is a description." | ||
|
||
|
||
def on_next(_state): | ||
_state["current"] += 1 | ||
return { | ||
steps: gr.update(current=_state["current"]), | ||
prev_btn: gr.update(visible=True if _state["current"] > 0 else False), | ||
next_btn: gr.update(visible=True if _state["current"] < 3 else False) | ||
} | ||
|
||
|
||
def on_prev(_state): | ||
_state["current"] -= 1 | ||
return { | ||
steps: gr.update(current=_state["current"]), | ||
prev_btn: gr.update(visible=True if _state["current"] > 0 else False), | ||
next_btn: gr.update(visible=True if _state["current"] < 3 else False) | ||
} | ||
|
||
|
||
with gr.Blocks() as demo: | ||
state = gr.State({"current": 0}) | ||
with ms.Application(): | ||
with antd.ConfigProvider(): | ||
with antd.Steps(0) as steps: | ||
antd.Steps.Item(title="Waiting", description=description) | ||
antd.Steps.Item(title="In Progress", | ||
sub_title="Left 00:00:08", | ||
description=description) | ||
antd.Steps.Item(title="Finished", description=description) | ||
prev_btn = antd.Button("Prev", visible=False) | ||
next_btn = antd.Button("Next", type="primary") | ||
|
||
prev_btn.click(fn=on_prev, | ||
inputs=[state], | ||
outputs=[steps, prev_btn, next_btn]) | ||
next_btn.click(fn=on_next, | ||
inputs=[state], | ||
outputs=[steps, prev_btn, next_btn]) | ||
|
||
if __name__ == "__main__": | ||
demo.queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters