Coloring commited on
Commit
2b0b2b4
·
1 Parent(s): 8fd63e7

Add usage recommendations for `ms.AutoLoading`

Browse files
components/antd/overview/README-zh_CN.md CHANGED
@@ -10,10 +10,11 @@ import modelscope_studio.components.antd as antd
10
 
11
  <demo name="quick_start"></demo>
12
 
13
- 注意:其中`ms.Application`与`antd.ConfigProvider`是必须的。
14
 
15
  - `Application` 包含了`modelscope_studio`中所有的组件依赖,请确保`modelscope_studio`所有导出的组件都被其包裹,否则页面将会无法成功预览。
16
  - `ConfigProvider` 与 Ant Design 中的功能一致,除此之外,我们还加了一些额外的适配来兼容 Gradio 的样式。因此,为了保证页面样式正常,所有的`antd`组件需要包裹在该组件下。
 
17
 
18
  ## 属性限制
19
 
 
10
 
11
  <demo name="quick_start"></demo>
12
 
13
+ 注意:其中`ms.Application`与`antd.ConfigProvider`是必须的,`ms.AutoLoading`为可选。。
14
 
15
  - `Application` 包含了`modelscope_studio`中所有的组件依赖,请确保`modelscope_studio`所有导出的组件都被其包裹,否则页面将会无法成功预览。
16
  - `ConfigProvider` 与 Ant Design 中的功能一致,除此之外,我们还加了一些额外的适配来兼容 Gradio 的样式。因此,为了保证页面样式正常,所有的`antd`组件需要包裹在该组件下。
17
+ - `AutoLoading`会在`Gradio`前端发送请求时自动为被包裹的内容添加加载动画。该组件会自动收集子组件的加载状态,建议至少在全局使用一次此组件,以显示兜底的加载反馈。
18
 
19
  ## 属性限制
20
 
components/antd/overview/README.md CHANGED
@@ -10,10 +10,11 @@ import modelscope_studio.components.antd as antd
10
 
11
  <demo name="quick_start"></demo>
12
 
13
- Note: Both `ms.Application` and `antd.ConfigProvider` are required.
14
 
15
  - `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.
16
  - `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
 
18
  ## Property Limitations
19
 
 
10
 
11
  <demo name="quick_start"></demo>
12
 
13
+ Note: Both `ms.Application` and `antd.ConfigProvider` are required, `ms.AutoLoading` is optional.
14
 
15
  - `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.
16
  - `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.
18
 
19
  ## Property Limitations
20
 
components/antd/overview/demos/quick_start.py CHANGED
@@ -5,7 +5,8 @@ import modelscope_studio.components.base as ms
5
  with gr.Blocks() as demo:
6
  with ms.Application():
7
  with antd.ConfigProvider():
8
- antd.Button("Hello Ant Design", type="primary")
 
9
 
10
  if __name__ == "__main__":
11
  demo.queue().launch()
 
5
  with gr.Blocks() as demo:
6
  with ms.Application():
7
  with antd.ConfigProvider():
8
+ with ms.AutoLoading():
9
+ antd.Button("Hello Ant Design", type="primary")
10
 
11
  if __name__ == "__main__":
12
  demo.queue().launch()
components/antdx/overview/README-zh_CN.md CHANGED
@@ -10,10 +10,11 @@ import modelscope_studio.components.antdx as antdx
10
 
11
  <demo name="quick_start"></demo>
12
 
13
- 注意:其中`ms.Application`与`antdx.XProvider`(或者`antd.ConfigProvider`)是必须的。
14
 
15
  - `Application` 包含了`modelscope_studio`中所有的组件依赖,请确保`modelscope_studio`所有导出的组件都被其包裹,否则页面将会无法成功预览。
16
  - `XProvider`(`ConfigProvider`) 与 Ant Design X(Ant Design)中的功能一致,除此之外,我们还加了一些额外的适配来兼容 Gradio 的样式。因此,为了保证页面样式正常,所有的`antdx`组件需要包裹在该组件下。
 
17
 
18
  ## 其他
19
 
 
10
 
11
  <demo name="quick_start"></demo>
12
 
13
+ 注意:其中`ms.Application`与`antdx.XProvider`(或者`antd.ConfigProvider`)是必须的,`ms.AutoLoading`为可选。
14
 
15
  - `Application` 包含了`modelscope_studio`中所有的组件依赖,请确保`modelscope_studio`所有导出的组件都被其包裹,否则页面将会无法成功预览。
16
  - `XProvider`(`ConfigProvider`) 与 Ant Design X(Ant Design)中的功能一致,除此之外,我们还加了一些额外的适配来兼容 Gradio 的样式。因此,为了保证页面样式正常,所有的`antdx`组件需要包裹在该组件下。
17
+ - `AutoLoading`会在`Gradio`前端发送请求时自动为被包裹的内容添加加载动画。该组件会自动收集子组件的加载状态,建议至少在全局使用一次此组件,以显示兜底的加载反馈。
18
 
19
  ## 其他
20
 
components/antdx/overview/README.md CHANGED
@@ -10,10 +10,11 @@ import modelscope_studio.components.antdx as antdx
10
 
11
  <demo name="quick_start"></demo>
12
 
13
- Note: Both `ms.Application` and `antdx.XProvider`(or `antd.ConfigProvider`) are required.
14
 
15
  - `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.
16
  - `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
 
18
  ## Others
19
 
 
10
 
11
  <demo name="quick_start"></demo>
12
 
13
+ Note: Both `ms.Application` and `antd.ConfigProvider` are required, `ms.AutoLoading` is optional.
14
 
15
  - `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.
16
  - `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.
18
 
19
  ## Others
20
 
components/antdx/overview/demos/quick_start.py CHANGED
@@ -5,13 +5,14 @@ import modelscope_studio.components.base as ms
5
  with gr.Blocks() as demo:
6
  with ms.Application():
7
  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
- )
 
15
 
16
  if __name__ == "__main__":
17
  demo.queue().launch()
 
5
  with gr.Blocks() as demo:
6
  with ms.Application():
7
  with antdx.XProvider(): # or antd.ConfigProvider
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
+ )
16
 
17
  if __name__ == "__main__":
18
  demo.queue().launch()
demos/example.py CHANGED
@@ -3,9 +3,8 @@ import modelscope_studio.components.antd as antd
3
  import modelscope_studio.components.base as ms
4
 
5
  with gr.Blocks() as demo:
6
- with ms.Application():
7
- with antd.ConfigProvider():
8
- antd.DatePicker()
9
 
10
  if __name__ == "__main__":
11
  demo.queue().launch()
 
3
  import modelscope_studio.components.base as ms
4
 
5
  with gr.Blocks() as demo:
6
+ with ms.Application(), antd.ConfigProvider(), ms.AutoLoading():
7
+ antd.DatePicker()
 
8
 
9
  if __name__ == "__main__":
10
  demo.queue().launch()