Skip to content

Commit 070ac18

Browse files
committed
docs: add usage recommendations for ms.AutoLoading to the docs
1 parent c8d0d7a commit 070ac18

10 files changed

Lines changed: 29 additions & 21 deletions

File tree

.changeset/metal-hornets-wink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'modelscope_studio': patch
3+
---
4+
5+
docs: add usage recommendations for `ms.AutoLoading` to the docs

README-zh_CN.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ import modelscope_studio.components.antd as antd
4848
import modelscope_studio.components.base as ms
4949

5050
with gr.Blocks() as demo:
51-
with ms.Application():
52-
with antd.ConfigProvider():
53-
antd.DatePicker()
51+
with ms.Application(), antd.ConfigProvider(), ms.AutoLoading():
52+
antd.DatePicker()
5453

5554
demo.queue().launch()
5655
```

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ import modelscope_studio.components.antd as antd
4848
import modelscope_studio.components.base as ms
4949

5050
with gr.Blocks() as demo:
51-
with ms.Application():
52-
with antd.ConfigProvider():
53-
antd.DatePicker()
51+
with ms.Application(), antd.ConfigProvider(), ms.AutoLoading():
52+
antd.DatePicker()
5453

5554
demo.queue().launch()
5655
```

docs/components/antd/overview/README-zh_CN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import modelscope_studio.components.antd as antd
1010

1111
<demo name="quick_start"></demo>
1212

13-
注意:其中`ms.Application``antd.ConfigProvider`是必须的。
13+
注意:其中`ms.Application``antd.ConfigProvider`是必须的,`ms.AutoLoading`为可选。
1414

1515
- `Application` 包含了`modelscope_studio`中所有的组件依赖,请确保`modelscope_studio`所有导出的组件都被其包裹,否则页面将会无法成功预览。
1616
- `ConfigProvider` 与 Ant Design 中的功能一致,除此之外,我们还加了一些额外的适配来兼容 Gradio 的样式。因此,为了保证页面样式正常,所有的`antd`组件需要包裹在该组件下。
17+
- `AutoLoading`会在`Gradio`前端发送请求时自动为被包裹的内容添加加载动画。该组件会自动收集子组件的加载状态,建议至少在全局使用一次此组件,以显示兜底的加载反馈。
1718

1819
## 属性限制
1920

docs/components/antd/overview/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import modelscope_studio.components.antd as antd
1010

1111
<demo name="quick_start"></demo>
1212

13-
Note: Both `ms.Application` and `antd.ConfigProvider` are required.
13+
Note: Both `ms.Application` and `antd.ConfigProvider` are required, `ms.AutoLoading` is optional.
1414

1515
- `Application` contains all component dependencies in `modelscope_studio`. Please ensure that all components exported from `modelscope_studio` are wrapped by it, otherwise the page will not be successfully previewed.
1616
- `ConfigProvider` functions the same as in Ant Design. Additionally, we have added some extra adaptations to be compatible with Gradio's styles. Therefore, to ensure normal page styling, all `antd` components need to be wrapped within this component.
17+
- `AutoLoading` will automatically add loading animations to the wrapped content when requests are sent from the `Gradio` frontend. This component will automatically collect the loading states of child components, it's recommended to use this component at least once globally to provide fallback loading feedback.
1718

1819
## Property Limitations
1920

docs/components/antd/overview/demos/quick_start.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
with gr.Blocks() as demo:
66
with ms.Application():
77
with antd.ConfigProvider():
8-
antd.Button("Hello Ant Design", type="primary")
8+
with ms.AutoLoading():
9+
antd.Button("Hello Ant Design", type="primary")
910

1011
if __name__ == "__main__":
1112
demo.queue().launch()

docs/components/antdx/overview/README-zh_CN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import modelscope_studio.components.antdx as antdx
1010

1111
<demo name="quick_start"></demo>
1212

13-
注意:其中`ms.Application``antdx.XProvider`(或者`antd.ConfigProvider`)是必须的。
13+
注意:其中`ms.Application``antdx.XProvider`(或者`antd.ConfigProvider`)是必须的`ms.AutoLoading`为可选
1414

1515
- `Application` 包含了`modelscope_studio`中所有的组件依赖,请确保`modelscope_studio`所有导出的组件都被其包裹,否则页面将会无法成功预览。
1616
- `XProvider``ConfigProvider`) 与 Ant Design X(Ant Design)中的功能一致,除此之外,我们还加了一些额外的适配来兼容 Gradio 的样式。因此,为了保证页面样式正常,所有的`antdx`组件需要包裹在该组件下。
17+
- `AutoLoading`会在`Gradio`前端发送请求时自动为被包裹的内容添加加载动画。该组件会自动收集子组件的加载状态,建议至少在全局使用一次此组件,以显示兜底的加载反馈。
1718

1819
## 其他
1920

docs/components/antdx/overview/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import modelscope_studio.components.antdx as antdx
1010

1111
<demo name="quick_start"></demo>
1212

13-
Note: Both `ms.Application` and `antdx.XProvider`(or `antd.ConfigProvider`) are required.
13+
Note: Both `ms.Application` and `antd.ConfigProvider` are required, `ms.AutoLoading` is optional.
1414

1515
- `Application` contains all component dependencies in `modelscope_studio`. Please ensure that all components exported from `modelscope_studio` are wrapped by it, otherwise the page will not be successfully previewed.
1616
- `XProvider`(`ConfigProvider`) functions the same as in Ant Design X(Ant Design). Additionally, we have added some extra adaptations to be compatible with Gradio's styles. Therefore, to ensure normal page styling, all `antdx` components need to be wrapped within this component.
17+
- `AutoLoading` will automatically add loading animations to the wrapped content when requests are sent from the `Gradio` frontend. This component will automatically collect the loading states of child components, it's recommended to use this component at least once globally to provide fallback loading feedback.
1718

1819
## Others
1920

docs/components/antdx/overview/demos/quick_start.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
with gr.Blocks() as demo:
66
with ms.Application():
77
with antdx.XProvider(): # or antd.ConfigProvider
8-
antdx.Welcome(
9-
icon=
10-
"https://mdn.alipayobjects.com/huamei_iwk9zp/afts/img/A*s5sNRo5LjfQAAAAAAAAAAAAADgCCAQ/fmt.webp",
11-
title="Hello, I'm Ant Design X",
12-
description=
13-
"Base on Ant Design, AGI product interface solution, create a better intelligent vision~"
14-
)
8+
with ms.AutoLoading():
9+
antdx.Welcome(
10+
icon=
11+
"https://mdn.alipayobjects.com/huamei_iwk9zp/afts/img/A*s5sNRo5LjfQAAAAAAAAAAAAADgCCAQ/fmt.webp",
12+
title="Hello, I'm Ant Design X",
13+
description=
14+
"Base on Ant Design, AGI product interface solution, create a better intelligent vision~"
15+
)
1516

1617
if __name__ == "__main__":
1718
demo.queue().launch()

docs/demos/example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
import modelscope_studio.components.base as ms
44

55
with gr.Blocks() as demo:
6-
with ms.Application():
7-
with antd.ConfigProvider():
8-
antd.DatePicker()
6+
with ms.Application(), antd.ConfigProvider(), ms.AutoLoading():
7+
antd.DatePicker()
98

109
if __name__ == "__main__":
1110
demo.queue().launch()

0 commit comments

Comments
 (0)