-
Notifications
You must be signed in to change notification settings - Fork 8
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
18 changed files
with
297 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Checkbox | ||
|
||
Collect user's choices. See [Ant Design](https://ant.design/components/checkbox/) 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 @@ | ||
# Checkbox | ||
|
||
Collect user's choices. See [Ant Design](https://ant.design/components/checkbox/) 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,38 @@ | ||
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(): | ||
with antd.Checkbox(): | ||
ms.Text("Checkbox") | ||
antd.Divider("Checkbox Group") | ||
with antd.Space(direction="vertical"): | ||
antd.Checkbox.Group(value=["Apple"], | ||
options=[ | ||
{ | ||
"label": 'Apple', | ||
"value": 'Apple' | ||
}, | ||
{ | ||
"label": 'Pear', | ||
"value": 'Pear' | ||
}, | ||
{ | ||
"label": 'Orange', | ||
"value": 'Orange', | ||
"disabled": True | ||
}, | ||
]) | ||
with antd.Checkbox.Group(value=["Pear", "Apple"]): | ||
with antd.Checkbox.Group.Option(value="Apple"): | ||
with ms.Slot("label"): | ||
antd.Typography.Text("Apple", type="success") | ||
antd.Checkbox.Group.Option(value="Pear", label="Pear") | ||
antd.Checkbox.Group.Option(value="Orange", | ||
disabled=True, | ||
label="Orange") | ||
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,8 @@ | ||
# ColorPicker | ||
|
||
Used for color selection. See [Ant Design](https://ant.design/components/color-picker/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> | ||
<demo name="preset" title="Preset Colors"></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,8 @@ | ||
# ColorPicker | ||
|
||
Used for color selection. See [Ant Design](https://ant.design/components/color-picker/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> | ||
<demo name="preset" title="Preset Colors"></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,26 @@ | ||
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(): | ||
with antd.Space(): | ||
antd.ColorPicker(value="#816DF8") | ||
antd.ColorPicker(value="#816DF8", show_text=True) | ||
antd.ColorPicker(value=[ | ||
{ | ||
"color": 'rgb(16, 142, 233)', | ||
"percent": 0, | ||
}, | ||
{ | ||
"color": 'rgb(135, 208, 104)', | ||
"percent": 100, | ||
}, | ||
], | ||
show_text=True, | ||
allow_clear=True, | ||
mode="gradient") | ||
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,56 @@ | ||
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(): | ||
with antd.Space(): | ||
antd.ColorPicker(value="#816DF8", | ||
presets=[{ | ||
"label": | ||
"primary", | ||
"colors": [ | ||
"#e6f4ff", "#bae0ff", "#91caff", | ||
"#69b1ff", "#4096ff", "#1677ff", | ||
"#0958d9", "#003eb3", "#002c8c", | ||
"#001d66" | ||
] | ||
}, { | ||
"label": | ||
"red", | ||
"colors": [ | ||
"#fff1f0", "#ffccc7", "#ffa39e", | ||
"#ff7875", "#ff4d4f", "#f5222d", | ||
"#cf1322", "#a8071a", "#820014", | ||
"#5c0011" | ||
] | ||
}, { | ||
"label": | ||
"green", | ||
"colors": [ | ||
"#f6ffed", "#d9f7be", "#b7eb8f", | ||
"#95de64", "#73d13d", "#52c41a", | ||
"#389e0d", "#237804", "#135200", | ||
"#092b00" | ||
] | ||
}]) | ||
with antd.ColorPicker(value="#816DF8"): | ||
with ms.Slot("presets"): | ||
with antd.ColorPicker.Preset(colors=[ | ||
"#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", | ||
"#4096ff", "#1677ff", "#0958d9", "#003eb3", | ||
"#002c8c", "#001d66" | ||
]): | ||
with ms.Slot("label"): | ||
antd.Typography.Text("Primary", type="success") | ||
antd.ColorPicker.Preset(colors=[ | ||
"#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", | ||
"#ff4d4f", "#f5222d", "#cf1322", "#a8071a", | ||
"#820014", "#5c0011" | ||
], | ||
label="red") | ||
|
||
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,8 @@ | ||
# DatePicker | ||
|
||
To select or input a date. See [Ant Design](https://ant.design/components/date-picker/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> | ||
<demo name="ranger_picker" title="Ranger Picker"></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,8 @@ | ||
# DatePicker | ||
|
||
To select or input a date. See [Ant Design](https://ant.design/components/date-picker/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> | ||
<demo name="ranger_picker" title="Ranger Picker"></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,36 @@ | ||
import time | ||
|
||
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(): | ||
with antd.Space(direction="vertical"): | ||
antd.DatePicker() | ||
antd.DatePicker(picker="week") | ||
antd.DatePicker(picker="month") | ||
antd.DatePicker(picker="quarter") | ||
antd.DatePicker(picker="year") | ||
antd.Divider("Preset Date") | ||
antd.DatePicker( | ||
need_confirm=True, | ||
presets=[ | ||
{ | ||
"label": 'Yesterday', | ||
# Python 的 timestamp | ||
"value": time.time() - 86400 | ||
}, | ||
{ | ||
"label": 'Last 7 Days', | ||
"value": time.time() - 86400 * 7 | ||
}, | ||
{ | ||
"label": 'Last 30 Days', | ||
"value": time.time() - 86400 * 30 | ||
} | ||
]) | ||
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,19 @@ | ||
import time | ||
|
||
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(): | ||
with antd.Space(direction="vertical"): | ||
antd.DatePicker.RangePicker() | ||
antd.DatePicker.RangePicker(show_time=True) | ||
antd.DatePicker.RangePicker(picker="week") | ||
antd.DatePicker.RangePicker(picker="month") | ||
antd.DatePicker.RangePicker(picker="quarter") | ||
antd.DatePicker.RangePicker(picker="year") | ||
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
Oops, something went wrong.