Spaces:
Running
Running
fix: 0.x => 1.0
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +0 -1
- Dockerfile +0 -15
- README-zh_CN.md +35 -14
- README.md +41 -19
- api/app.py +1 -1
- app.py +419 -27
- components/WaterfallGallery/app.py +0 -6
- components/antd/affix/README-zh_CN.md +8 -0
- components/antd/affix/README.md +8 -0
- components/{MultimodalInput → antd/affix}/app.py +1 -1
- components/antd/affix/demos/basic.py +16 -0
- components/antd/affix/demos/container_to_scroll.py +27 -0
- components/antd/alert/README-zh_CN.md +7 -0
- components/antd/alert/README.md +7 -0
- components/{Flow → antd/alert}/app.py +1 -1
- components/antd/alert/demos/basic.py +40 -0
- components/antd/anchor/README-zh_CN.md +7 -0
- components/antd/anchor/README.md +7 -0
- components/{Lifecycle → antd/anchor}/app.py +1 -1
- components/antd/anchor/demos/basic.py +38 -0
- components/antd/auto_complete/README-zh_CN.md +8 -0
- components/antd/auto_complete/README.md +8 -0
- components/{Chatbot → antd/auto_complete}/app.py +1 -1
- components/antd/auto_complete/demos/basic.py +32 -0
- components/antd/auto_complete/demos/lookup_patterns.py +57 -0
- components/antd/avatar/README-zh_CN.md +8 -0
- components/antd/avatar/README.md +8 -0
- components/antd/avatar/app.py +6 -0
- components/antd/avatar/demos/basic.py +43 -0
- components/antd/avatar/demos/group.py +99 -0
- components/antd/badge/README-zh_CN.md +8 -0
- components/antd/badge/README.md +8 -0
- components/antd/badge/app.py +6 -0
- components/antd/badge/demos/basic.py +36 -0
- components/antd/badge/demos/ribbon.py +52 -0
- components/antd/breadcrumb/README-zh_CN.md +7 -0
- components/antd/breadcrumb/README.md +7 -0
- components/antd/breadcrumb/app.py +6 -0
- components/antd/breadcrumb/demos/basic.py +45 -0
- components/antd/button/README-zh_CN.md +7 -0
- components/antd/button/README.md +7 -0
- components/antd/button/app.py +6 -0
- components/antd/button/demos/basic.py +26 -0
- components/antd/calendar/README-zh_CN.md +8 -0
- components/antd/calendar/README.md +8 -0
- components/antd/calendar/app.py +6 -0
- components/antd/calendar/demos/basic.py +15 -0
- components/antd/calendar/demos/notice_calendar.py +56 -0
- components/antd/card/README-zh_CN.md +9 -0
- components/antd/card/README.md +9 -0
.gitattributes
CHANGED
@@ -33,4 +33,3 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
34 |
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
35 |
*.whl filter=lfs diff=lfs merge=lfs -text
|
36 |
-
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
|
|
33 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
34 |
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
35 |
*.whl filter=lfs diff=lfs merge=lfs -text
|
|
Dockerfile
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
FROM python:3.9
|
2 |
-
|
3 |
-
WORKDIR /code
|
4 |
-
|
5 |
-
COPY --link --chown=1000 . .
|
6 |
-
|
7 |
-
RUN mkdir -p /tmp/cache/
|
8 |
-
RUN chmod a+rwx -R /tmp/cache/
|
9 |
-
ENV TRANSFORMERS_CACHE=/tmp/cache/
|
10 |
-
|
11 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
-
|
13 |
-
ENV PYTHONUNBUFFERED=1 GRADIO_ALLOW_FLAGGING=never GRADIO_NUM_PORTS=1 GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 SYSTEM=spaces
|
14 |
-
|
15 |
-
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README-zh_CN.md
CHANGED
@@ -1,33 +1,54 @@
|
|
1 |
-
|
2 |
|
3 |
<p align="center">
|
4 |
<img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" height="60" style="vertical-align: middle;"/>
|
5 |
<span style="font-size: 30px; vertical-align: middle;">
|
6 |
✖️
|
7 |
</span>
|
8 |
-
<img src="https://
|
9 |
<p>
|
10 |
|
11 |
<p align="center">
|
12 |
-
<a href="https://github.com/modelscope/modelscope-studio">GitHub</a> | 🤖 <a href="https://modelscope.cn/studios/modelscope/modelscope-studio
|
13 |
|
14 |
-
`modelscope_studio
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
```sh
|
19 |
pip install modelscope_studio
|
20 |
```
|
21 |
|
22 |
-
##
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
|
26 |
-
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
1 |
+
# ModelScope Studio
|
2 |
|
3 |
<p align="center">
|
4 |
<img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" height="60" style="vertical-align: middle;"/>
|
5 |
<span style="font-size: 30px; vertical-align: middle;">
|
6 |
✖️
|
7 |
</span>
|
8 |
+
<img src="https://img.alicdn.com/imgextra/i1/O1CN01OmXst929933KJd7og_!!6000000008024-55-tps-2016-703.svg" height="60" style="vertical-align: middle;">
|
9 |
<p>
|
10 |
|
11 |
<p align="center">
|
12 |
+
<a href="https://github.com/modelscope/modelscope-studio">GitHub</a> | 🤖 <a href="https://modelscope.cn/studios/modelscope/modelscope-studio">ModelScope Studio</a> | 🤗 <a href="https://huggingface.co/spaces/modelscope/modelscope-studio">Hugging Face Space</a>
|
13 |
|
14 |
+
`modelscope_studio`是一个基于 Gradio 的三方组件库,为开发者提供更定制化的界面搭建能力和更丰富的组件使用形式。
|
15 |
|
16 |
+
目前支持的 UI 库:
|
17 |
+
|
18 |
+
- [Ant Design](https://ant.design/)
|
19 |
+
|
20 |
+
## 何时使用
|
21 |
+
|
22 |
+
比起 Gradio 自身的组件,`modelscope_studio`更加注重页面布局和组件的灵活性,如果您想要构建更漂亮的用户界面,我们非常推荐您使用`modelscope_studio`。
|
23 |
+
|
24 |
+
然而,当您的应用需要 Gradio 在 Python 端更多地处理内置数据时,`modelscope_studio`的组件可能不是最好的选择,但是不用担心,它可以很好地与已有的 Gradio 组件相结合,您仍然可以使用`modelscope_studio`来优化您的应用。
|
25 |
+
|
26 |
+
## 依赖
|
27 |
+
|
28 |
+
- Gradio >= 4.0
|
29 |
+
|
30 |
+
## 安装
|
31 |
|
32 |
```sh
|
33 |
pip install modelscope_studio
|
34 |
```
|
35 |
|
36 |
+
## 示例
|
37 |
+
|
38 |
+
<demo name="example"></demo>
|
39 |
+
|
40 |
+
## 迁移到 1.0
|
41 |
|
42 |
+
如果您在之前使用了`modelscope_studio`的组件,并且想要在新版本中继续使用。不需要对原有组件做任何修改,只需要在外层引入`ms.Application`即可。
|
43 |
|
44 |
+
```python
|
45 |
+
import gradio as gr
|
46 |
+
import modelscope_studio.components.base as ms
|
47 |
+
import modelscope_studio.components.legacy as mgr
|
48 |
|
49 |
+
with gr.Blocks() as demo:
|
50 |
+
with ms.Application():
|
51 |
+
mgr.Chatbot()
|
52 |
+
|
53 |
+
demo.launch()
|
54 |
+
```
|
README.md
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
---
|
2 |
tags:
|
3 |
- gradio-custom-component
|
4 |
-
-
|
5 |
-
-
|
6 |
-
-
|
7 |
-
- gradio-template-Chatbot
|
8 |
-
- gradio-template-Markdown
|
9 |
title: modelscope-studio
|
10 |
colorFrom: blue
|
11 |
colorTo: gray
|
12 |
-
|
|
|
13 |
pinned: false
|
|
|
|
|
14 |
license: apache-2.0
|
15 |
---
|
16 |
|
17 |
-
|
18 |
|
19 |
<p align="center">
|
20 |
<img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" height="60" style="vertical-align: middle;"/>
|
@@ -25,25 +26,46 @@ license: apache-2.0
|
|
25 |
<p>
|
26 |
|
27 |
<p align="center">
|
28 |
-
<a href="https://github.com/modelscope/modelscope-studio">GitHub</a> | 🤖 <a href="https://modelscope.cn/studios/modelscope/modelscope-studio
|
29 |
|
30 |
-
`modelscope_studio` is a
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
```sh
|
35 |
pip install modelscope_studio
|
36 |
```
|
37 |
|
38 |
-
##
|
|
|
|
|
|
|
|
|
39 |
|
40 |
-
|
41 |
|
42 |
-
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
1 |
---
|
2 |
tags:
|
3 |
- gradio-custom-component
|
4 |
+
- component library
|
5 |
+
- Ant Design
|
6 |
+
- modelscope-studio
|
|
|
|
|
7 |
title: modelscope-studio
|
8 |
colorFrom: blue
|
9 |
colorTo: gray
|
10 |
+
short_description: A third-party component library based on Gradio.
|
11 |
+
sdk: gradio
|
12 |
pinned: false
|
13 |
+
header: mini
|
14 |
+
app_file: app.py
|
15 |
license: apache-2.0
|
16 |
---
|
17 |
|
18 |
+
# ModelScope Studio
|
19 |
|
20 |
<p align="center">
|
21 |
<img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" height="60" style="vertical-align: middle;"/>
|
|
|
26 |
<p>
|
27 |
|
28 |
<p align="center">
|
29 |
+
<a href="https://github.com/modelscope/modelscope-studio">GitHub</a> | 🤖 <a href="https://modelscope.cn/studios/modelscope/modelscope-studio">ModelScope Studio</a> | 🤗 <a href="https://huggingface.co/spaces/modelscope/modelscope-studio">Hugging Face Space</a>
|
30 |
|
31 |
+
`modelscope_studio` is a third-party component library based on Gradio, offers developers more customized interface building capabilities and a richer variety of component usage forms.
|
32 |
|
33 |
+
Currently supported UI libraries:
|
34 |
+
|
35 |
+
- [Ant Design](https://ant.design/)
|
36 |
+
|
37 |
+
## When to Use
|
38 |
+
|
39 |
+
Compared to the original components of Gradio, `modelscope_studio` focuses more on page layout and component flexibility. If you want to build a more beautiful user interface, we highly recommend using `modelscope_studio`.
|
40 |
+
|
41 |
+
However, when your application needs Gradio to handle more built-in data on the Python side, the components of `modelscope_studio` may not be the best choice, but don't worry, it integrates well with existing Gradio components, you can still use `modelscope_studio` to optimize your application.
|
42 |
+
|
43 |
+
## Dependencies
|
44 |
+
|
45 |
+
- Gradio >= 4.0
|
46 |
+
|
47 |
+
## Installation
|
48 |
|
49 |
```sh
|
50 |
pip install modelscope_studio
|
51 |
```
|
52 |
|
53 |
+
## Examples
|
54 |
+
|
55 |
+
<demo name="example"></demo>
|
56 |
+
|
57 |
+
## Migration to 1.0
|
58 |
|
59 |
+
If you have used the `modelscope_studio` component before and want to continue using it in the new version, you do not need to make any changes to the original component, just import `ms.Application` in the outer layer.
|
60 |
|
61 |
+
```python
|
62 |
+
import gradio as gr
|
63 |
+
import modelscope_studio.components.base as ms
|
64 |
+
import modelscope_studio.components.legacy as mgr
|
65 |
|
66 |
+
with gr.Blocks() as demo:
|
67 |
+
with ms.Application():
|
68 |
+
mgr.Chatbot()
|
69 |
+
|
70 |
+
demo.launch()
|
71 |
+
```
|
api/app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
|
3 |
-
from components.Docs import Docs
|
4 |
|
5 |
|
6 |
def resolve(relative_path: str):
|
|
|
1 |
import os
|
2 |
|
3 |
+
from components.legacy.Docs import Docs
|
4 |
|
5 |
|
6 |
def resolve(relative_path: str):
|
app.py
CHANGED
@@ -1,30 +1,422 @@
|
|
1 |
-
import
|
2 |
-
from
|
3 |
-
|
4 |
-
from
|
5 |
-
from
|
6 |
-
from
|
7 |
-
from
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
]
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
|
|
|
|
1 |
+
import os
|
2 |
+
from typing import Literal
|
3 |
+
|
4 |
+
from helper.Docs import Docs
|
5 |
+
from helper.env import is_modelscope_studio
|
6 |
+
from helper.Site import Site
|
7 |
+
from legacy_app import legacy_demo
|
8 |
+
|
9 |
+
import modelscope_studio.components.antd as antd
|
10 |
+
import modelscope_studio.components.base as ms
|
11 |
+
|
12 |
+
|
13 |
+
def get_text(text: str, cn_text: str):
|
14 |
+
if is_modelscope_studio:
|
15 |
+
return cn_text
|
16 |
+
return text
|
17 |
+
|
18 |
+
|
19 |
+
def get_docs(file_path: str, type: Literal["antd", "base"]):
|
20 |
+
import importlib.util
|
21 |
+
|
22 |
+
components = []
|
23 |
+
components_dir = os.path.join(os.path.dirname(file_path), "components",
|
24 |
+
type)
|
25 |
+
for dir in os.listdir(components_dir):
|
26 |
+
abs_dir = os.path.join(components_dir, dir)
|
27 |
+
if os.path.isdir(abs_dir):
|
28 |
+
app_file = os.path.join(abs_dir, "app.py")
|
29 |
+
if os.path.exists(app_file):
|
30 |
+
components.append(dir)
|
31 |
+
|
32 |
+
docs = {}
|
33 |
+
for component in components:
|
34 |
+
spec = importlib.util.spec_from_file_location(
|
35 |
+
"doc", os.path.join(components_dir, component, "app.py"))
|
36 |
+
module = importlib.util.module_from_spec(spec)
|
37 |
+
spec.loader.exec_module(module)
|
38 |
+
docs[component] = module.docs
|
39 |
+
return docs
|
40 |
+
|
41 |
+
|
42 |
+
index_docs = {"modelscope_studio": Docs(__file__)}
|
43 |
+
|
44 |
+
base_docs = get_docs(__file__, "base")
|
45 |
+
antd_docs = get_docs(__file__, "antd")
|
46 |
+
|
47 |
+
default_active_tab = "index"
|
48 |
+
index_menu_items = [{
|
49 |
+
"label": get_text("ModelScope-Studio", "ModelScope-Studio"),
|
50 |
+
"key": "modelscope_studio"
|
51 |
+
}]
|
52 |
+
|
53 |
+
base_menu_items = [{
|
54 |
+
"label":
|
55 |
+
get_text("Core", "核心"),
|
56 |
+
"type":
|
57 |
+
"group",
|
58 |
+
"children": [{
|
59 |
+
"label": get_text("Application", "Application 应用"),
|
60 |
+
"key": "application"
|
61 |
+
}, {
|
62 |
+
"label": get_text("AutoLoading", "AutoLoading 自动加载"),
|
63 |
+
"key": "auto_loading"
|
64 |
+
}, {
|
65 |
+
"label": get_text("Slot", "Slot 插槽"),
|
66 |
+
"key": "slot"
|
67 |
+
}, {
|
68 |
+
"label": get_text("Fragment", "Fragment 片段"),
|
69 |
+
"key": "fragment"
|
70 |
+
}]
|
71 |
+
}, {
|
72 |
+
"label":
|
73 |
+
get_text("Layout", "布局"),
|
74 |
+
"type":
|
75 |
+
"group",
|
76 |
+
"children": [{
|
77 |
+
"label": "Div",
|
78 |
+
"key": "div"
|
79 |
+
}, {
|
80 |
+
"label": "Span",
|
81 |
+
"key": "span"
|
82 |
+
}, {
|
83 |
+
"label": "Text",
|
84 |
+
"key": "text"
|
85 |
+
}]
|
86 |
+
}, {
|
87 |
+
"label":
|
88 |
+
get_text("Render", "渲染"),
|
89 |
+
"type":
|
90 |
+
"group",
|
91 |
+
"children": [{
|
92 |
+
"label": get_text("Each", "Each 循环"),
|
93 |
+
"key": "each"
|
94 |
+
}, {
|
95 |
+
"label": get_text("Filter", "Filter 过滤"),
|
96 |
+
"key": "filter"
|
97 |
+
}]
|
98 |
+
}]
|
99 |
+
|
100 |
+
antd_menu_items = [{
|
101 |
+
"label": get_text("Overview", "概览"),
|
102 |
+
"key": "overview"
|
103 |
+
}, {
|
104 |
+
"label":
|
105 |
+
get_text("General", "通用"),
|
106 |
+
"type":
|
107 |
+
"group",
|
108 |
+
"children": [{
|
109 |
+
"label": get_text("Button", "Button 按钮"),
|
110 |
+
"key": "button"
|
111 |
+
}, {
|
112 |
+
"label": get_text("FloatButton", "FloatButton 悬浮按钮"),
|
113 |
+
"key": "float_button"
|
114 |
+
}, {
|
115 |
+
"label": get_text("Icon", "Icon 图标"),
|
116 |
+
"key": "icon"
|
117 |
+
}, {
|
118 |
+
"label": get_text("Typography", "Typography 排版"),
|
119 |
+
"key": "typography"
|
120 |
+
}]
|
121 |
+
}, {
|
122 |
+
"label":
|
123 |
+
get_text("Layout", "布局"),
|
124 |
+
"type":
|
125 |
+
"group",
|
126 |
+
"children": [{
|
127 |
+
"label": get_text("Divider", "Divider 分割线"),
|
128 |
+
"key": "divider"
|
129 |
+
}, {
|
130 |
+
"label": get_text("Flex", "Flex 弹性布局"),
|
131 |
+
"key": "flex"
|
132 |
+
}, {
|
133 |
+
"label": get_text("Grid", "Grid 栅格"),
|
134 |
+
"key": "grid"
|
135 |
+
}, {
|
136 |
+
"label": get_text("Layout", "Layout 布局"),
|
137 |
+
"key": "layout"
|
138 |
+
}, {
|
139 |
+
"label": get_text("Space", "Space 间距"),
|
140 |
+
"key": "space"
|
141 |
+
}, {
|
142 |
+
"label": get_text("Splitter", "Splitter 分割面板"),
|
143 |
+
"key": "splitter"
|
144 |
+
}]
|
145 |
+
}, {
|
146 |
+
"label":
|
147 |
+
get_text("Navigation", "导航"),
|
148 |
+
"type":
|
149 |
+
"group",
|
150 |
+
"children": [{
|
151 |
+
"label": get_text("Anchor", "Anchor 锚点"),
|
152 |
+
"key": "anchor"
|
153 |
+
}, {
|
154 |
+
"label": get_text("Breadcrumb", "Breadcrumb 面包屑"),
|
155 |
+
"key": "breadcrumb"
|
156 |
+
}, {
|
157 |
+
"label": get_text("Dropdown", "Dropdown 下拉菜单"),
|
158 |
+
"key": "dropdown"
|
159 |
+
}, {
|
160 |
+
"label": get_text("Menu", "Menu 导航菜单"),
|
161 |
+
"key": "menu"
|
162 |
+
}, {
|
163 |
+
"label": get_text("Pagination", "Pagination 分页"),
|
164 |
+
"key": "pagination"
|
165 |
+
}, {
|
166 |
+
"label": get_text("Steps", "Steps 步骤条"),
|
167 |
+
"key": "steps"
|
168 |
+
}]
|
169 |
+
}, {
|
170 |
+
"label":
|
171 |
+
get_text("Data Entry", "数据录入"),
|
172 |
+
"type":
|
173 |
+
"group",
|
174 |
+
"children": [{
|
175 |
+
"label": get_text("AutoComplete", "AutoComplete 自动完成"),
|
176 |
+
"key": "auto_complete"
|
177 |
+
}, {
|
178 |
+
"label": get_text("Cascader", "Cascader 级联选择"),
|
179 |
+
"key": "cascader"
|
180 |
+
}, {
|
181 |
+
"label": get_text("Checkbox", "Checkbox 多选框"),
|
182 |
+
"key": "checkbox"
|
183 |
+
}, {
|
184 |
+
"label": get_text("ColorPicker", "ColorPicker 颜色选择器"),
|
185 |
+
"key": "color_picker"
|
186 |
+
}, {
|
187 |
+
"label": get_text("DatePicker", "DatePicker 日期选择框"),
|
188 |
+
"key": "date_picker"
|
189 |
+
}, {
|
190 |
+
"label": get_text("Form", "Form 表单"),
|
191 |
+
"key": "form"
|
192 |
+
}, {
|
193 |
+
"label": get_text("Input", "Input 输入框"),
|
194 |
+
"key": "input"
|
195 |
+
}, {
|
196 |
+
"label": get_text("InputNumber", "InputNumber 数字输入框"),
|
197 |
+
"key": "input_number"
|
198 |
+
}, {
|
199 |
+
"label": get_text("Mentions", "Mentions 提及"),
|
200 |
+
"key": "mentions"
|
201 |
+
}, {
|
202 |
+
"label": get_text("Radio", "Radio 单选框"),
|
203 |
+
"key": "radio"
|
204 |
+
}, {
|
205 |
+
"label": get_text("Rate", "Rate 评分"),
|
206 |
+
"key": "rate"
|
207 |
+
}, {
|
208 |
+
"label": get_text("Select", "Select 选择器"),
|
209 |
+
"key": "select"
|
210 |
+
}, {
|
211 |
+
"label": get_text("Slider", "Slider 滑动输入条"),
|
212 |
+
"key": "slider"
|
213 |
+
}, {
|
214 |
+
"label": get_text("Switch", "Switch 开关"),
|
215 |
+
"key": "switch"
|
216 |
+
}, {
|
217 |
+
"label": get_text("TimePicker", "TimePicker 时间选择器"),
|
218 |
+
"key": "time_picker"
|
219 |
+
}, {
|
220 |
+
"label": get_text("Transfer", "Transfer 穿梭框"),
|
221 |
+
"key": "transfer"
|
222 |
+
}, {
|
223 |
+
"label": get_text("TreeSelect", "TreeSelect 树选择"),
|
224 |
+
"key": "tree_select"
|
225 |
+
}, {
|
226 |
+
"label": get_text("Upload", "Upload 上传"),
|
227 |
+
"key": "upload"
|
228 |
+
}]
|
229 |
+
}, {
|
230 |
+
"label":
|
231 |
+
get_text("Data Display", "数据展示"),
|
232 |
+
"type":
|
233 |
+
"group",
|
234 |
+
"children": [{
|
235 |
+
"label": get_text("Avatar", "Avatar 头像"),
|
236 |
+
"key": "avatar"
|
237 |
+
}, {
|
238 |
+
"label": get_text("Badge", "Badge 徽标数"),
|
239 |
+
"key": "badge"
|
240 |
+
}, {
|
241 |
+
"label": get_text("Calendar", "Calendar 日历"),
|
242 |
+
"key": "calendar"
|
243 |
+
}, {
|
244 |
+
"label": get_text("Card", "Card 卡片"),
|
245 |
+
"key": "card"
|
246 |
+
}, {
|
247 |
+
"label": get_text("Carousel", "Carousel 走马灯"),
|
248 |
+
"key": "carousel"
|
249 |
+
}, {
|
250 |
+
"label": get_text("Collapse", "Collapse 折叠面板"),
|
251 |
+
"key": "collapse"
|
252 |
+
}, {
|
253 |
+
"label": get_text("Descriptions", "Descriptions 描述列表"),
|
254 |
+
"key": "descriptions"
|
255 |
+
}, {
|
256 |
+
"label": get_text("Empty", "Empty 空状态"),
|
257 |
+
"key": "empty"
|
258 |
+
}, {
|
259 |
+
"label": get_text("Image", "Image 图片"),
|
260 |
+
"key": "image"
|
261 |
+
}, {
|
262 |
+
"label": get_text("List", "List 列表"),
|
263 |
+
"key": "list"
|
264 |
+
}, {
|
265 |
+
"label": get_text("Popover", "Popover 气泡卡片"),
|
266 |
+
"key": "popover"
|
267 |
+
}, {
|
268 |
+
"label": get_text("QRCode", "QRCode 二维码"),
|
269 |
+
"key": "qr_code"
|
270 |
+
}, {
|
271 |
+
"label": get_text("Segmented", "Segmented 分段控制器"),
|
272 |
+
"key": "segmented"
|
273 |
+
}, {
|
274 |
+
"label": get_text("Statistic", "Statistic 统计数值"),
|
275 |
+
"key": "statistic"
|
276 |
+
}, {
|
277 |
+
"label": get_text("Table", "Table 表格"),
|
278 |
+
"key": "table"
|
279 |
+
}, {
|
280 |
+
"label": get_text("Tabs", "Tabs 标签页"),
|
281 |
+
"key": "tabs"
|
282 |
+
}, {
|
283 |
+
"label": get_text("Tag", "Tag 标签"),
|
284 |
+
"key": "tag"
|
285 |
+
}, {
|
286 |
+
"label": get_text("Timeline", "Timeline 时间轴"),
|
287 |
+
"key": "timeline"
|
288 |
+
}, {
|
289 |
+
"label": get_text("Tooltip", "Tooltip 文字提示"),
|
290 |
+
"key": "tooltip"
|
291 |
+
}, {
|
292 |
+
"label": get_text("Tour", "Tour 漫游式引导"),
|
293 |
+
"key": "tour"
|
294 |
+
}, {
|
295 |
+
"label": get_text("Tree", "Tree 树形控件"),
|
296 |
+
"key": "tree"
|
297 |
+
}]
|
298 |
+
}, {
|
299 |
+
"label":
|
300 |
+
get_text("Feedback", "反馈"),
|
301 |
+
"type":
|
302 |
+
"group",
|
303 |
+
"children": [{
|
304 |
+
"label": get_text("Alert", "Alert 警告提示"),
|
305 |
+
"key": "alert"
|
306 |
+
}, {
|
307 |
+
"label": get_text("Drawer", "Drawer 抽屉"),
|
308 |
+
"key": "drawer"
|
309 |
+
}, {
|
310 |
+
"label": get_text("Message", "Message 全局提示"),
|
311 |
+
"key": "message"
|
312 |
+
}, {
|
313 |
+
"label": get_text("Modal", "Modal 对话框"),
|
314 |
+
"key": "modal"
|
315 |
+
}, {
|
316 |
+
"label": get_text("Notification", "Notification 通知提醒框"),
|
317 |
+
"key": "notification"
|
318 |
+
}, {
|
319 |
+
"label": get_text("Popconfirm", "Popconfirm 气泡确认框"),
|
320 |
+
"key": "popconfirm"
|
321 |
+
}, {
|
322 |
+
"label": get_text("Progress", "Progress 进度条"),
|
323 |
+
"key": "progress"
|
324 |
+
}, {
|
325 |
+
"label": get_text("Result", "Result 结果"),
|
326 |
+
"key": "result"
|
327 |
+
}, {
|
328 |
+
"label": get_text("Skeleton", "Skeleton 骨架屏"),
|
329 |
+
"key": "skeleton"
|
330 |
+
}, {
|
331 |
+
"label": get_text("Spin", "Spin 加载中"),
|
332 |
+
"key": "spin"
|
333 |
+
}, {
|
334 |
+
"label": get_text("Watermark", "Watermark 水印"),
|
335 |
+
"key": "watermark"
|
336 |
+
}]
|
337 |
+
}, {
|
338 |
+
"label":
|
339 |
+
get_text("Other", "其他"),
|
340 |
+
"type":
|
341 |
+
"group",
|
342 |
+
"children": [{
|
343 |
+
"label": get_text("Affix", "Affix 固钉"),
|
344 |
+
"key": "affix"
|
345 |
+
}, {
|
346 |
+
"label": get_text("ConfigProvider", "ConfigProvider 全局化配置"),
|
347 |
+
"key": "config_provider"
|
348 |
+
}]
|
349 |
+
}]
|
350 |
+
|
351 |
+
|
352 |
+
def logo():
|
353 |
+
with antd.Flex(align='center', gap=8):
|
354 |
+
antd.Image(os.path.join(os.path.dirname(__file__),
|
355 |
+
"./resources/modelscope.png"),
|
356 |
+
preview=False,
|
357 |
+
height=20)
|
358 |
+
ms.Span('✖️')
|
359 |
+
antd.Image(os.path.join(os.path.dirname(__file__),
|
360 |
+
"./resources/gradio.png"),
|
361 |
+
preview=False,
|
362 |
+
height=40)
|
363 |
+
|
364 |
+
|
365 |
+
def more_components():
|
366 |
+
with antd.Button(type="link",
|
367 |
+
block=True,
|
368 |
+
href="https://ant.design/components/overview/",
|
369 |
+
href_target="_blank",
|
370 |
+
elem_style=dict(display="block",
|
371 |
+
textAlign="left",
|
372 |
+
whiteSpace="nowrap",
|
373 |
+
textOverflow="ellipsis",
|
374 |
+
overflow="hidden")):
|
375 |
+
ms.Text(get_text("More Components", "更多组件"))
|
376 |
+
|
377 |
+
with ms.Slot("icon"):
|
378 |
+
antd.Icon("ExportOutlined", elem_style=dict(marginRight=4))
|
379 |
+
|
380 |
+
|
381 |
+
tabs = [
|
382 |
+
{
|
383 |
+
"label": get_text("Overview", "概览"),
|
384 |
+
"key": "index",
|
385 |
+
"default_active_key": "modelscope_studio",
|
386 |
+
"menus": index_menu_items
|
387 |
+
},
|
388 |
+
{
|
389 |
+
"label": get_text("Base Components", "基础组件"),
|
390 |
+
"key": "base",
|
391 |
+
"default_active_key": "application",
|
392 |
+
"menus": base_menu_items
|
393 |
+
},
|
394 |
+
{
|
395 |
+
"label": get_text("Antd Components", "Antd 组件"),
|
396 |
+
"key": "antd",
|
397 |
+
"default_active_key": "overview",
|
398 |
+
"menus": antd_menu_items,
|
399 |
+
"extra_menu_footer": more_components
|
400 |
+
},
|
401 |
+
{
|
402 |
+
"label": get_text("Version 0.x", "0.x 版本"),
|
403 |
+
"key": "legacy",
|
404 |
+
"content": legacy_demo
|
405 |
+
},
|
406 |
]
|
407 |
|
408 |
+
site = Site(
|
409 |
+
tabs=tabs,
|
410 |
+
docs={
|
411 |
+
# match the key of tabs
|
412 |
+
"index": index_docs,
|
413 |
+
"antd": antd_docs,
|
414 |
+
"base": base_docs
|
415 |
+
},
|
416 |
+
default_active_tab=default_active_tab,
|
417 |
+
logo=logo)
|
418 |
+
|
419 |
+
demo = site.render()
|
420 |
|
421 |
+
if __name__ == "__main__":
|
422 |
+
demo.queue().launch(ssr_mode=False)
|
components/WaterfallGallery/app.py
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
from components.Docs import Docs
|
2 |
-
|
3 |
-
docs = Docs(__file__)
|
4 |
-
|
5 |
-
if __name__ == "__main__":
|
6 |
-
docs.render().queue().launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
components/antd/affix/README-zh_CN.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Affix
|
2 |
+
|
3 |
+
Stick an element to the viewport. See [Ant Design](https://ant.design/components/affix/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="container_to_scroll" title="Container to scroll"></demo>
|
components/antd/affix/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Affix
|
2 |
+
|
3 |
+
Stick an element to the viewport. See [Ant Design](https://ant.design/components/affix/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="container_to_scroll" title="Container to scroll"></demo>
|
components/{MultimodalInput → antd/affix}/app.py
RENAMED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
docs = Docs(__file__)
|
4 |
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
|
3 |
docs = Docs(__file__)
|
4 |
|
components/antd/affix/demos/basic.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with antd.Affix(offset_top=100):
|
10 |
+
antd.Button("Affix to top", type="primary")
|
11 |
+
antd.Divider()
|
12 |
+
with antd.Affix(offset_bottom=100):
|
13 |
+
antd.Button("Affix to bottom", type="primary")
|
14 |
+
|
15 |
+
if __name__ == "__main__":
|
16 |
+
demo.queue().launch()
|
components/antd/affix/demos/container_to_scroll.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with ms.Div(elem_id="affix_container",
|
10 |
+
elem_style={
|
11 |
+
"width": '100%',
|
12 |
+
"height": 100,
|
13 |
+
"overflow": 'auto',
|
14 |
+
"boxShadow": '0 0 0 1px #1677ff',
|
15 |
+
"scrollbarWidth": 'thin',
|
16 |
+
"scrollbarGutter": 'stable',
|
17 |
+
}):
|
18 |
+
with ms.Div(elem_style=dict(width="100%", height=1000)):
|
19 |
+
with antd.Affix(
|
20 |
+
get_target=
|
21 |
+
"() => document.querySelector('#affix_container')"
|
22 |
+
):
|
23 |
+
antd.Button("Fixed at the top of container",
|
24 |
+
type="primary")
|
25 |
+
|
26 |
+
if __name__ == "__main__":
|
27 |
+
demo.queue().launch()
|
components/antd/alert/README-zh_CN.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Alert
|
2 |
+
|
3 |
+
Display warning messages that require attention. See [Ant Design](https://ant.design/components/alert/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
components/antd/alert/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Alert
|
2 |
+
|
3 |
+
Display warning messages that require attention. See [Ant Design](https://ant.design/components/alert/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
components/{Flow → antd/alert}/app.py
RENAMED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
docs = Docs(__file__)
|
4 |
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
|
3 |
docs = Docs(__file__)
|
4 |
|
components/antd/alert/demos/basic.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
data = [{
|
7 |
+
"message": "Success Text",
|
8 |
+
"description":
|
9 |
+
"Success Description Success Description Success Description Success Description",
|
10 |
+
"type": "success"
|
11 |
+
}, {
|
12 |
+
"message": "Info Text",
|
13 |
+
"description":
|
14 |
+
"Info Description Info Description Info Description Info Description",
|
15 |
+
"type": "info"
|
16 |
+
}, {
|
17 |
+
"message": "Warning Text",
|
18 |
+
"description":
|
19 |
+
"Warning Description Warning Description Warning Description Warning Description",
|
20 |
+
"type": "warning"
|
21 |
+
}, {
|
22 |
+
"message": "Error Text",
|
23 |
+
"description":
|
24 |
+
"Error Description Error Description Error Description Error Description",
|
25 |
+
"type": "error"
|
26 |
+
}]
|
27 |
+
|
28 |
+
with gr.Blocks() as demo:
|
29 |
+
with ms.Application():
|
30 |
+
with antd.ConfigProvider():
|
31 |
+
with antd.Space(direction="vertical"):
|
32 |
+
for item in data:
|
33 |
+
antd.Alert(message=item["message"],
|
34 |
+
description=item["description"],
|
35 |
+
type=item["type"],
|
36 |
+
closable=True,
|
37 |
+
show_icon=True)
|
38 |
+
|
39 |
+
if __name__ == "__main__":
|
40 |
+
demo.queue().launch()
|
components/antd/anchor/README-zh_CN.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Anchor
|
2 |
+
|
3 |
+
Hyperlinks to scroll on one page. See [Ant Design](https://ant.design/components/anchor/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic" fixed></demo>
|
components/antd/anchor/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Anchor
|
2 |
+
|
3 |
+
Hyperlinks to scroll on one page. See [Ant Design](https://ant.design/components/anchor/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic" fixed></demo>
|
components/{Lifecycle → antd/anchor}/app.py
RENAMED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
docs = Docs(__file__)
|
4 |
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
|
3 |
docs = Docs(__file__)
|
4 |
|
components/antd/anchor/demos/basic.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with antd.Row():
|
10 |
+
with antd.Col(span=16):
|
11 |
+
with ms.Div(elem_style=dict(maxHeight="700px",
|
12 |
+
overflow="auto")):
|
13 |
+
ms.Div(elem_id="part-1",
|
14 |
+
elem_style=dict(
|
15 |
+
height="100vh",
|
16 |
+
background="rgba(255,0,0,0.02)"))
|
17 |
+
ms.Div(elem_id="part-2",
|
18 |
+
elem_style=dict(
|
19 |
+
height="100vh",
|
20 |
+
background="rgba(0,255,0,0.02)"))
|
21 |
+
ms.Div(elem_id="part-3",
|
22 |
+
elem_style=dict(
|
23 |
+
height="100vh",
|
24 |
+
background="rgba(0,0,255,0.02)"))
|
25 |
+
with antd.Col(span=8):
|
26 |
+
with antd.Anchor():
|
27 |
+
with antd.Anchor.Item(href="#part-1", key="part-1"):
|
28 |
+
with ms.Slot("title"):
|
29 |
+
antd.Typography.Title("Part 1")
|
30 |
+
antd.Anchor.Item(title="Part 2",
|
31 |
+
href="#part-2",
|
32 |
+
key="part-2")
|
33 |
+
antd.Anchor.Item(title="Part 3",
|
34 |
+
href="#part-3",
|
35 |
+
key="part-3")
|
36 |
+
|
37 |
+
if __name__ == "__main__":
|
38 |
+
demo.queue().launch()
|
components/antd/auto_complete/README-zh_CN.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AutoComplete
|
2 |
+
|
3 |
+
Autocomplete function of input field. See [Ant Design](https://ant.design/components/auto-complete/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="lookup_patterns" title="Lookup-Patterns"></demo>
|
components/antd/auto_complete/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AutoComplete
|
2 |
+
|
3 |
+
Autocomplete function of input field. See [Ant Design](https://ant.design/components/auto-complete/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="lookup_patterns" title="Lookup-Patterns"></demo>
|
components/{Chatbot → antd/auto_complete}/app.py
RENAMED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
docs = Docs(__file__)
|
4 |
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
|
3 |
docs = Docs(__file__)
|
4 |
|
components/antd/auto_complete/demos/basic.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
|
7 |
+
def on_search(e: gr.EventData):
|
8 |
+
text = e._data["payload"][0]
|
9 |
+
domains = ["gmail.com", "163.com", "qq.com"]
|
10 |
+
if not text or "@" in text:
|
11 |
+
return gr.update(options=[])
|
12 |
+
return gr.update(options=[{
|
13 |
+
"value": f"{text}@{domain}",
|
14 |
+
"label": f"{text}@{domain}"
|
15 |
+
} for domain in domains])
|
16 |
+
|
17 |
+
|
18 |
+
with gr.Blocks() as demo:
|
19 |
+
with ms.Application():
|
20 |
+
with antd.ConfigProvider():
|
21 |
+
auto_complete = antd.AutoComplete(placeholder="Typing here...",
|
22 |
+
elem_style=dict(width=200))
|
23 |
+
antd.Divider("Customize Input Component")
|
24 |
+
with antd.AutoComplete() as customize_auto_complete:
|
25 |
+
with ms.Slot("children"):
|
26 |
+
antd.Input.Textarea(placeholder="Typing here...")
|
27 |
+
auto_complete.search(on_search, outputs=[auto_complete])
|
28 |
+
customize_auto_complete.search(on_search,
|
29 |
+
outputs=[customize_auto_complete])
|
30 |
+
|
31 |
+
if __name__ == "__main__":
|
32 |
+
demo.queue().launch()
|
components/antd/auto_complete/demos/lookup_patterns.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
|
7 |
+
def Title(title: str):
|
8 |
+
with antd.Flex(align="center", justify="space-between"):
|
9 |
+
ms.Span(title)
|
10 |
+
|
11 |
+
antd.Button("more",
|
12 |
+
type="link",
|
13 |
+
href="https://www.google.com/search?q=antd",
|
14 |
+
href_target="_blank")
|
15 |
+
|
16 |
+
|
17 |
+
def AutoCompleteSubOption(title: str, count: int):
|
18 |
+
with antd.AutoComplete.Option(value=title):
|
19 |
+
with ms.Slot("label"):
|
20 |
+
with antd.Flex(align="center", justify="space-between"):
|
21 |
+
ms.Text(title)
|
22 |
+
with ms.Span():
|
23 |
+
antd.Icon("UserOutlined")
|
24 |
+
ms.Text(count)
|
25 |
+
|
26 |
+
|
27 |
+
with gr.Blocks() as demo:
|
28 |
+
with ms.Application():
|
29 |
+
with antd.ConfigProvider():
|
30 |
+
with antd.AutoComplete(elem_style=dict(width=250),
|
31 |
+
size="large",
|
32 |
+
popup_match_select_width=500):
|
33 |
+
with ms.Slot("children"):
|
34 |
+
antd.Input.Search(size="large",
|
35 |
+
placeholder="Typing here...")
|
36 |
+
with ms.Slot("options"):
|
37 |
+
with antd.AutoComplete.Option():
|
38 |
+
with ms.Slot("label"):
|
39 |
+
Title("Libraries")
|
40 |
+
with ms.Slot("options"):
|
41 |
+
AutoCompleteSubOption("Ant Design", 10000)
|
42 |
+
AutoCompleteSubOption('AntDesign UI', 10600)
|
43 |
+
with antd.AutoComplete.Option():
|
44 |
+
with ms.Slot("label"):
|
45 |
+
Title("Solutions")
|
46 |
+
with ms.Slot("options"):
|
47 |
+
AutoCompleteSubOption('AntDesign UI FAQ', 60100)
|
48 |
+
AutoCompleteSubOption('AntDesign FAQ', 30010)
|
49 |
+
with antd.AutoComplete.Option():
|
50 |
+
with ms.Slot("label"):
|
51 |
+
Title("Articles")
|
52 |
+
with ms.Slot("options"):
|
53 |
+
AutoCompleteSubOption('AntDesign design language',
|
54 |
+
100000)
|
55 |
+
|
56 |
+
if __name__ == "__main__":
|
57 |
+
demo.queue().launch()
|
components/antd/avatar/README-zh_CN.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Avatar
|
2 |
+
|
3 |
+
Used to represent users or things, supporting the display of images, icons, or characters. See [Ant Design](https://ant.design/components/avatar/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="group" title="Avatar.Group"></demo>
|
components/antd/avatar/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Avatar
|
2 |
+
|
3 |
+
Used to represent users or things, supporting the display of images, icons, or characters. See [Ant Design](https://ant.design/components/avatar/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="group" title="Avatar.Group"></demo>
|
components/antd/avatar/app.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
+
|
3 |
+
docs = Docs(__file__)
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
docs.render().queue().launch()
|
components/antd/avatar/demos/basic.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with antd.Space(size=16, wrap=True):
|
10 |
+
with antd.Avatar():
|
11 |
+
with ms.Slot("icon"):
|
12 |
+
antd.Icon("UserOutlined")
|
13 |
+
with antd.Avatar():
|
14 |
+
ms.Text('U')
|
15 |
+
with antd.Avatar(shape="square"):
|
16 |
+
ms.Text("USER")
|
17 |
+
antd.Avatar(
|
18 |
+
"https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
|
19 |
+
)
|
20 |
+
with antd.Avatar():
|
21 |
+
with ms.Slot("src"):
|
22 |
+
antd.Image(
|
23 |
+
"https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg",
|
24 |
+
alt="avatar")
|
25 |
+
with antd.Avatar(elem_style=dict(backgroundColor='#fde3cf',
|
26 |
+
color='#f56a00')):
|
27 |
+
ms.Text("U")
|
28 |
+
with antd.Avatar(elem_style=dict(backgroundColor='#87d068')):
|
29 |
+
with ms.Slot("icon"):
|
30 |
+
antd.Icon("UserOutlined")
|
31 |
+
|
32 |
+
antd.Divider("With Badge")
|
33 |
+
with antd.Space(size=24):
|
34 |
+
with antd.Badge(count=1):
|
35 |
+
with antd.Avatar(shape="square"):
|
36 |
+
with ms.Slot("icon"):
|
37 |
+
antd.Icon("UserOutlined")
|
38 |
+
with antd.Badge(dot=True):
|
39 |
+
with antd.Avatar(shape="square"):
|
40 |
+
with ms.Slot("icon"):
|
41 |
+
antd.Icon("UserOutlined")
|
42 |
+
if __name__ == "__main__":
|
43 |
+
demo.queue().launch()
|
components/antd/avatar/demos/group.py
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with antd.Avatar.Group():
|
10 |
+
antd.Avatar(
|
11 |
+
value="https://api.dicebear.com/7.x/miniavs/svg?seed=1")
|
12 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#f56a00")):
|
13 |
+
ms.Text("K")
|
14 |
+
with antd.Tooltip(title="Ant User", placement="top"):
|
15 |
+
with antd.Avatar(elem_style=dict(
|
16 |
+
backgroundColor="#87d068")):
|
17 |
+
with ms.Slot("icon"):
|
18 |
+
antd.Icon("UserOutlined")
|
19 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#1677ff")):
|
20 |
+
with ms.Slot("icon"):
|
21 |
+
antd.Icon("AntDesignOutlined")
|
22 |
+
|
23 |
+
antd.Divider()
|
24 |
+
|
25 |
+
with antd.Avatar.Group(max=dict(
|
26 |
+
count=2,
|
27 |
+
style=dict(color="#f56a00", backgroundColor="#fde3cf"))):
|
28 |
+
antd.Avatar(
|
29 |
+
value="https://api.dicebear.com/7.x/miniavs/svg?seed=2")
|
30 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#f56a00")):
|
31 |
+
ms.Text("K")
|
32 |
+
with antd.Tooltip(title="Ant User", placement="top"):
|
33 |
+
with antd.Avatar(elem_style=dict(
|
34 |
+
backgroundColor="#87d068")):
|
35 |
+
with ms.Slot("icon"):
|
36 |
+
antd.Icon("UserOutlined")
|
37 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#1677ff")):
|
38 |
+
with ms.Slot("icon"):
|
39 |
+
antd.Icon("AntDesignOutlined")
|
40 |
+
|
41 |
+
antd.Divider()
|
42 |
+
|
43 |
+
with antd.Avatar.Group(size="large",
|
44 |
+
max=dict(count=2,
|
45 |
+
style=dict(
|
46 |
+
color="#f56a00",
|
47 |
+
backgroundColor="#fde3cf"))):
|
48 |
+
antd.Avatar(
|
49 |
+
value="https://api.dicebear.com/7.x/miniavs/svg?seed=3")
|
50 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#f56a00")):
|
51 |
+
ms.Text("K")
|
52 |
+
with antd.Tooltip(title="Ant User", placement="top"):
|
53 |
+
with antd.Avatar(elem_style=dict(
|
54 |
+
backgroundColor="#87d068")):
|
55 |
+
with ms.Slot("icon"):
|
56 |
+
antd.Icon("UserOutlined")
|
57 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#1677ff")):
|
58 |
+
with ms.Slot("icon"):
|
59 |
+
antd.Icon("AntDesignOutlined")
|
60 |
+
|
61 |
+
antd.Divider()
|
62 |
+
|
63 |
+
with antd.Avatar.Group(size="large",
|
64 |
+
max=dict(count=2,
|
65 |
+
style=dict(
|
66 |
+
color="#f56a00",
|
67 |
+
backgroundColor="#fde3cf",
|
68 |
+
cursor="pointer"),
|
69 |
+
popover=dict(trigger="click"))):
|
70 |
+
antd.Avatar(
|
71 |
+
value=
|
72 |
+
"https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
|
73 |
+
)
|
74 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#f56a00")):
|
75 |
+
ms.Text("K")
|
76 |
+
with antd.Tooltip(title="Ant User", placement="top"):
|
77 |
+
with antd.Avatar(elem_style=dict(
|
78 |
+
backgroundColor="#87d068")):
|
79 |
+
with ms.Slot("icon"):
|
80 |
+
antd.Icon("UserOutlined")
|
81 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#1677ff")):
|
82 |
+
with ms.Slot("icon"):
|
83 |
+
antd.Icon("AntDesignOutlined")
|
84 |
+
|
85 |
+
antd.Divider()
|
86 |
+
|
87 |
+
with antd.Avatar.Group(shape="square"):
|
88 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#fde3cf")):
|
89 |
+
ms.Text("A")
|
90 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#f56a00")):
|
91 |
+
ms.Text("K")
|
92 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#87d068")):
|
93 |
+
with ms.Slot("icon"):
|
94 |
+
antd.Icon("UserOutlined")
|
95 |
+
with antd.Avatar(elem_style=dict(backgroundColor="#1677ff")):
|
96 |
+
with ms.Slot("icon"):
|
97 |
+
antd.Icon("AntDesignOutlined")
|
98 |
+
if __name__ == "__main__":
|
99 |
+
demo.queue().launch()
|
components/antd/badge/README-zh_CN.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Badge
|
2 |
+
|
3 |
+
Small numerical value or status descriptor for UI elements. See [Ant Design](https://ant.design/components/badge/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="ribbon" title="Ribbon"></demo>
|
components/antd/badge/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Badge
|
2 |
+
|
3 |
+
Small numerical value or status descriptor for UI elements. See [Ant Design](https://ant.design/components/badge/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="ribbon" title="Ribbon"></demo>
|
components/antd/badge/app.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
+
|
3 |
+
docs = Docs(__file__)
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
docs.render().queue().launch()
|
components/antd/badge/demos/basic.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with antd.Space(size="middle"):
|
10 |
+
with antd.Badge(count=5):
|
11 |
+
antd.Avatar(shape="square", size="large")
|
12 |
+
|
13 |
+
with antd.Badge(count=0, show_zero=True):
|
14 |
+
antd.Avatar(shape="square", size="large")
|
15 |
+
|
16 |
+
with antd.Badge(elem_style=dict(color="#f5222d")):
|
17 |
+
with ms.Slot("count"):
|
18 |
+
antd.Icon("ClockCircleOutlined")
|
19 |
+
antd.Avatar(shape="square", size="large")
|
20 |
+
with antd.Badge(count=99, overflow_count=10):
|
21 |
+
antd.Avatar(shape="square", size="large")
|
22 |
+
with antd.Badge(count=1000, overflow_count=999):
|
23 |
+
antd.Avatar(shape="square", size="large")
|
24 |
+
|
25 |
+
with antd.Badge(dot=True):
|
26 |
+
antd.Icon("NotificationOutlined",
|
27 |
+
elem_style=dict(fontSize="16"))
|
28 |
+
antd.Divider("Status")
|
29 |
+
with antd.Space(direction="vertical"):
|
30 |
+
antd.Badge(status="success", text="Success")
|
31 |
+
antd.Badge(status="error", text="Error")
|
32 |
+
antd.Badge(status="default", text="Default")
|
33 |
+
antd.Badge(status="processing", text="Processing")
|
34 |
+
antd.Badge(status="warning", text="Warning")
|
35 |
+
if __name__ == "__main__":
|
36 |
+
demo.queue().launch()
|
components/antd/badge/demos/ribbon.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with antd.Space(direction="vertical",
|
10 |
+
size="middle",
|
11 |
+
elem_style=dict(width="100%")):
|
12 |
+
with antd.Badge.Ribbon(text="Hippies"):
|
13 |
+
with antd.Card(title="Pushes open the window",
|
14 |
+
size="small"):
|
15 |
+
ms.Text("and raises the spyglass.")
|
16 |
+
|
17 |
+
with antd.Badge.Ribbon(text="Hippies", color="pink"):
|
18 |
+
with antd.Card(title="Pushes open the window",
|
19 |
+
size="small"):
|
20 |
+
ms.Text("and raises the spyglass.")
|
21 |
+
|
22 |
+
with antd.Badge.Ribbon(text="Hippies", color="red"):
|
23 |
+
with antd.Card(title="Pushes open the window",
|
24 |
+
size="small"):
|
25 |
+
ms.Text("and raises the spyglass.")
|
26 |
+
|
27 |
+
with antd.Badge.Ribbon(text="Hippies", color="cyan"):
|
28 |
+
with antd.Card(title="Pushes open the window",
|
29 |
+
size="small"):
|
30 |
+
ms.Text("and raises the spyglass.")
|
31 |
+
|
32 |
+
with antd.Badge.Ribbon(text="Hippies", color="green"):
|
33 |
+
with antd.Card(title="Pushes open the window",
|
34 |
+
size="small"):
|
35 |
+
ms.Text("and raises the spyglass.")
|
36 |
+
|
37 |
+
with antd.Badge.Ribbon(text="Hippies", color="purple"):
|
38 |
+
with antd.Card(title="Pushes open the window",
|
39 |
+
size="small"):
|
40 |
+
ms.Text("and raises the spyglass.")
|
41 |
+
|
42 |
+
with antd.Badge.Ribbon(text="Hippies", color="volcano"):
|
43 |
+
with antd.Card(title="Pushes open the window",
|
44 |
+
size="small"):
|
45 |
+
ms.Text("and raises the spyglass.")
|
46 |
+
|
47 |
+
with antd.Badge.Ribbon(text="Hippies", color="magenta"):
|
48 |
+
with antd.Card(title="Pushes open the window",
|
49 |
+
size="small"):
|
50 |
+
ms.Text("and raises the spyglass.")
|
51 |
+
if __name__ == "__main__":
|
52 |
+
demo.queue().launch()
|
components/antd/breadcrumb/README-zh_CN.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Breadcrumb
|
2 |
+
|
3 |
+
Display the current location within a hierarchy. And allow going back to states higher up in the hierarchy. See [Ant Design](https://ant.design/components/breadcrumb/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
components/antd/breadcrumb/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Breadcrumb
|
2 |
+
|
3 |
+
Display the current location within a hierarchy. And allow going back to states higher up in the hierarchy. See [Ant Design](https://ant.design/components/breadcrumb/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
components/antd/breadcrumb/app.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
+
|
3 |
+
docs = Docs(__file__)
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
docs.render().queue().launch()
|
components/antd/breadcrumb/demos/basic.py
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with antd.Breadcrumb():
|
10 |
+
antd.Breadcrumb.Item(title="Ant Design")
|
11 |
+
with antd.Breadcrumb.Item():
|
12 |
+
with ms.Slot("title"):
|
13 |
+
antd.Button(type="link", href="#")
|
14 |
+
with antd.Breadcrumb.Item():
|
15 |
+
with ms.Slot("title"):
|
16 |
+
antd.Button(type="link", href="General")
|
17 |
+
with ms.Slot("menu.items"):
|
18 |
+
with antd.Menu.Item(key="1"):
|
19 |
+
with ms.Slot("label"):
|
20 |
+
antd.Button(
|
21 |
+
"General",
|
22 |
+
type="link",
|
23 |
+
href="https://modelscope.cn",
|
24 |
+
href_target="_blank",
|
25 |
+
)
|
26 |
+
with antd.Menu.Item(key="2"):
|
27 |
+
with ms.Slot("label"):
|
28 |
+
antd.Button(
|
29 |
+
"Layout",
|
30 |
+
type="link",
|
31 |
+
href="https://ant.design/",
|
32 |
+
href_target="_blank",
|
33 |
+
)
|
34 |
+
with antd.Menu.Item(key="3"):
|
35 |
+
with ms.Slot("label"):
|
36 |
+
antd.Button(
|
37 |
+
"Navigation",
|
38 |
+
type="link",
|
39 |
+
href="https://www.alipay.com/",
|
40 |
+
href_target="_blank",
|
41 |
+
)
|
42 |
+
antd.Breadcrumb.Item(title="Button")
|
43 |
+
|
44 |
+
if __name__ == "__main__":
|
45 |
+
demo.queue().launch()
|
components/antd/button/README-zh_CN.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Button
|
2 |
+
|
3 |
+
To trigger an operation. See [Ant Design](https://ant.design/components/button/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
components/antd/button/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Button
|
2 |
+
|
3 |
+
To trigger an operation. See [Ant Design](https://ant.design/components/button/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
components/antd/button/app.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
+
|
3 |
+
docs = Docs(__file__)
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
docs.render().queue().launch()
|
components/antd/button/demos/basic.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
with antd.Flex(gap="small", wrap=True):
|
10 |
+
btn = antd.Button("Primary Button", type="primary")
|
11 |
+
btn.click(lambda: print("clicked"))
|
12 |
+
with antd.Button():
|
13 |
+
ms.Text("Default Button")
|
14 |
+
antd.Button("Dashed Button", type="dashed")
|
15 |
+
antd.Button("Text Button", type="text")
|
16 |
+
antd.Button("Link Button", type="link")
|
17 |
+
antd.Button("Filled", color="default", variant="filled")
|
18 |
+
antd.Button("Filled", color="danger", variant="filled")
|
19 |
+
with antd.Button(type="primary", loading=True):
|
20 |
+
ms.Text("Loading")
|
21 |
+
with ms.Slot("icon"):
|
22 |
+
antd.Icon("PoweroffOutlined")
|
23 |
+
antd.Button("Block", type="primary", block=True)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
demo.queue().launch()
|
components/antd/calendar/README-zh_CN.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Calendar
|
2 |
+
|
3 |
+
A container that displays data in calendar form. See [Ant Design](https://ant.design/components/calendar/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="notice_calendar" title="Notice Calendar"></demo>
|
components/antd/calendar/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Calendar
|
2 |
+
|
3 |
+
A container that displays data in calendar form. See [Ant Design](https://ant.design/components/calendar/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="notice_calendar" title="Notice Calendar"></demo>
|
components/antd/calendar/app.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
+
|
3 |
+
docs = Docs(__file__)
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
docs.render().queue().launch()
|
components/antd/calendar/demos/basic.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
antd.Calendar()
|
10 |
+
antd.Divider("Card")
|
11 |
+
with antd.Card():
|
12 |
+
antd.Calendar(fullscreen=False)
|
13 |
+
|
14 |
+
if __name__ == "__main__":
|
15 |
+
demo.queue().launch()
|
components/antd/calendar/demos/notice_calendar.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import modelscope_studio.components.antd as antd
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
with ms.Application():
|
8 |
+
with antd.ConfigProvider():
|
9 |
+
antd.Calendar(cell_render="""(current, info) => {
|
10 |
+
if (info.type === 'date') {
|
11 |
+
if (current.date() === 8) {
|
12 |
+
const React = window.ms_globals.React;
|
13 |
+
const antd = window.ms_globals.antd;
|
14 |
+
const events = [
|
15 |
+
{
|
16 |
+
type: 'warning',
|
17 |
+
content: 'This is warning event.',
|
18 |
+
},
|
19 |
+
{
|
20 |
+
type: 'success',
|
21 |
+
content: 'This is usual event.',
|
22 |
+
},
|
23 |
+
];
|
24 |
+
return React.createElement(
|
25 |
+
'ul',
|
26 |
+
{
|
27 |
+
style: {
|
28 |
+
margin: 0,
|
29 |
+
padding: 0,
|
30 |
+
listStyle: 'none'
|
31 |
+
}
|
32 |
+
},
|
33 |
+
events.map((event) => {
|
34 |
+
return React.createElement(
|
35 |
+
'li',
|
36 |
+
{
|
37 |
+
style: {
|
38 |
+
marginBottom: 8,
|
39 |
+
},
|
40 |
+
},
|
41 |
+
[
|
42 |
+
React.createElement(antd.Badge, {
|
43 |
+
status: event.type,
|
44 |
+
text: event.content,
|
45 |
+
}),
|
46 |
+
]
|
47 |
+
);
|
48 |
+
})
|
49 |
+
);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
return info.originNode;
|
53 |
+
}""")
|
54 |
+
|
55 |
+
if __name__ == "__main__":
|
56 |
+
demo.queue().launch()
|
components/antd/card/README-zh_CN.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Card
|
2 |
+
|
3 |
+
A container for displaying information. See [Ant Design](https://ant.design/components/card/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="customized_content" title="Customized Content"></demo>
|
9 |
+
<demo name="grid_card" title="Grid Card"></demo>
|
components/antd/card/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Card
|
2 |
+
|
3 |
+
A container for displaying information. See [Ant Design](https://ant.design/components/card/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
8 |
+
<demo name="customized_content" title="Customized Content"></demo>
|
9 |
+
<demo name="grid_card" title="Grid Card"></demo>
|