Coloring commited on
Commit
6af7472
·
1 Parent(s): ce48dbe

feat: support gradio 6.28.0

Browse files
README-zh_CN.md CHANGED
@@ -27,9 +27,7 @@
27
 
28
  ## 依赖
29
 
30
- - Gradio >= 6.0.0
31
-
32
- > 注意:您的 Gradio 版本必须`<=6.8.0`,[为什么?](https://github.com/gradio-app/gradio/issues/13131)
33
 
34
  ## 安装
35
 
 
27
 
28
  ## 依赖
29
 
30
+ - Gradio >= 6.28.0
 
 
31
 
32
  ## 安装
33
 
README.md CHANGED
@@ -9,7 +9,7 @@ colorFrom: blue
9
  colorTo: gray
10
  short_description: A third-party component library based on Gradio.
11
  sdk: gradio
12
- sdk_version: 6.8.0
13
  pinned: false
14
  header: mini
15
  app_file: app.py
@@ -45,9 +45,7 @@ However, when your application needs Gradio to handle more built-in data on the
45
 
46
  ## Dependencies
47
 
48
- - Gradio >= 6.0.0
49
-
50
- > Note: Your Gradio version must`<=6.8.0`, [why?](https://github.com/gradio-app/gradio/issues/13131)
51
 
52
  ## Installation
53
 
 
9
  colorTo: gray
10
  short_description: A third-party component library based on Gradio.
11
  sdk: gradio
12
+ sdk_version: 6.28.0
13
  pinned: false
14
  header: mini
15
  app_file: app.py
 
45
 
46
  ## Dependencies
47
 
48
+ - Gradio >= 6.28.0
 
 
49
 
50
  ## Installation
51
 
app.py CHANGED
@@ -353,6 +353,9 @@ antd_menu_items = [{
353
  }, {
354
  "label": get_text("List", "List 列表"),
355
  "key": "list"
 
 
 
356
  }, {
357
  "label": get_text("Popover", "Popover 气泡卡片"),
358
  "key": "popover"
@@ -434,6 +437,9 @@ antd_menu_items = [{
434
  "children": [{
435
  "label": get_text("Affix", "Affix 固钉"),
436
  "key": "affix"
 
 
 
437
  }, {
438
  "label": get_text("ConfigProvider", "ConfigProvider 全局化配置"),
439
  "key": "config_provider"
 
353
  }, {
354
  "label": get_text("List", "List 列表"),
355
  "key": "list"
356
+ }, {
357
+ "label": get_text("Listy", "Listy 虚拟列表"),
358
+ "key": "listy"
359
  }, {
360
  "label": get_text("Popover", "Popover 气泡卡片"),
361
  "key": "popover"
 
437
  "children": [{
438
  "label": get_text("Affix", "Affix 固钉"),
439
  "key": "affix"
440
+ }, {
441
+ "label": get_text("BorderBeam", "BorderBeam 边框流光"),
442
+ "key": "border_beam"
443
  }, {
444
  "label": get_text("ConfigProvider", "ConfigProvider 全局化配置"),
445
  "key": "config_provider"
components/antd/border_beam/README-zh_CN.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # BorderBeam
2
+
3
+ A decorative component that renders a flowing highlight animation along the border of its child container. See [Ant Design](https://ant.design/components/border-beam/) for more information.
4
+
5
+ ## Examples
6
+
7
+ <demo name="basic"></demo>
8
+ <demo name="color" title="Custom Color"></demo>
9
+ <demo name="multiple_beams" title="Multiple Beams"></demo>
components/antd/border_beam/README.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # BorderBeam
2
+
3
+ A decorative component that renders a flowing highlight animation along the border of its child container. See [Ant Design](https://ant.design/components/border-beam/) for more information.
4
+
5
+ ## Examples
6
+
7
+ <demo name="basic"></demo>
8
+ <demo name="color" title="Custom Color"></demo>
9
+ <demo name="multiple_beams" title="Multiple Beams"></demo>
components/antd/border_beam/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/border_beam/demos/basic.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ 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
+ with antd.BorderBeam(elem_style=dict(borderRadius=8)):
9
+ with antd.Card(title="BorderBeam",
10
+ elem_style=dict(width=320, marginBottom=0)):
11
+ ms.Div("A flowing highlight runs along the border.")
12
+
13
+ if __name__ == "__main__":
14
+ demo.queue().launch()
components/antd/border_beam/demos/color.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ 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
+ with antd.Space(size="large"):
9
+ # a solid color beam
10
+ with antd.BorderBeam(color="#f5222d",
11
+ duration=3,
12
+ elem_style=dict(borderRadius=8)):
13
+ with antd.Card(title="Solid Color",
14
+ elem_style=dict(width=280, marginBottom=0)):
15
+ ms.Div("color='#f5222d'")
16
+ # a gradient beam
17
+ with antd.BorderBeam(color=[
18
+ dict(color="#1677ff", percent=0),
19
+ dict(color="#722ed1", percent=50),
20
+ dict(color="#eb2f96", percent=70),
21
+ ],
22
+ line_width=2,
23
+ size=120,
24
+ elem_style=dict(borderRadius=8)):
25
+ with antd.Card(title="Gradient",
26
+ elem_style=dict(width=280, marginBottom=0)):
27
+ ms.Div("color=[{color, percent}, ...]")
28
+
29
+ if __name__ == "__main__":
30
+ demo.queue().launch()
components/antd/border_beam/demos/multiple_beams.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ 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
+ with antd.Space(size="large"):
9
+ for count in [1, 2, 4]:
10
+ with antd.BorderBeam(count=count,
11
+ duration=4,
12
+ elem_style=dict(borderRadius=8)):
13
+ with antd.Card(title=f"count={count}",
14
+ elem_style=dict(width=240,
15
+ marginBottom=0)):
16
+ ms.Div(
17
+ f"{count} beam(s) evenly distributed along the border."
18
+ )
19
+
20
+ if __name__ == "__main__":
21
+ demo.queue().launch()
components/antd/listy/README-zh_CN.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Listy
2
+
3
+ A high performance list component which renders large data sets with virtual scrolling. See [Ant Design](https://ant.design/components/listy/) for more information.
4
+
5
+ Items are plain data, and each item is rendered by the `itemRender` slot (or the `item_render` function property). `row_key` accepts either a field name of the item or a Javascript function string.
6
+
7
+ ## Examples
8
+
9
+ <demo name="basic"></demo>
10
+ <demo name="group" title="Group with Sticky Header"></demo>
11
+ <demo name="item_render_function" title="Render Item by Javascript Function"></demo>
components/antd/listy/README.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Listy
2
+
3
+ A high performance list component which renders large data sets with virtual scrolling. See [Ant Design](https://ant.design/components/listy/) for more information.
4
+
5
+ Items are plain data, and each item is rendered by the `itemRender` slot (or the `item_render` function property). `row_key` accepts either a field name of the item or a Javascript function string.
6
+
7
+ ## Examples
8
+
9
+ <demo name="basic"></demo>
10
+ <demo name="group" title="Group with Sticky Header"></demo>
11
+ <demo name="item_render_function" title="Render Item by Javascript Function"></demo>
components/antd/listy/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/listy/demos/basic.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import modelscope_studio.components.antd as antd
3
+ import modelscope_studio.components.base as ms
4
+
5
+ items = [{
6
+ "key": f"item-{i}",
7
+ "title": f"Item {i}",
8
+ } for i in range(2000)]
9
+
10
+ with gr.Blocks() as demo:
11
+ with ms.Application():
12
+ with antd.ConfigProvider():
13
+ with antd.Listy(items=items,
14
+ row_key="key",
15
+ height=360,
16
+ virtual=True,
17
+ elem_style=dict(border="1px solid #f0f0f0",
18
+ borderRadius=8)):
19
+ with ms.Slot(
20
+ "itemRender",
21
+ params_mapping="(item) => ({ value: item.title })"):
22
+ ms.Div(elem_style=dict(padding="0 16px"))
23
+
24
+ if __name__ == "__main__":
25
+ demo.queue().launch()
components/antd/listy/demos/group.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import modelscope_studio.components.antd as antd
3
+ import modelscope_studio.components.base as ms
4
+
5
+ categories = ["Fruit", "Vegetable", "Drink", "Snack"]
6
+
7
+ items = [{
8
+ "key": f"item-{i}",
9
+ "title": f"Item {i}",
10
+ "category": categories[i % len(categories)],
11
+ } for i in range(400)]
12
+
13
+ with gr.Blocks() as demo:
14
+ with ms.Application():
15
+ with antd.ConfigProvider():
16
+ with antd.Listy(items=items,
17
+ row_key="key",
18
+ height=360,
19
+ sticky=True,
20
+ virtual=True,
21
+ group=dict(key="(item) => item.category"),
22
+ elem_style=dict(border="1px solid #f0f0f0",
23
+ borderRadius=8)):
24
+ with ms.Slot(
25
+ "group.title",
26
+ params_mapping=
27
+ "(groupKey, items) => ({ value: groupKey + ' (' + items.length + ')' })"
28
+ ):
29
+ ms.Div(elem_style=dict(fontWeight=600))
30
+ with ms.Slot(
31
+ "itemRender",
32
+ params_mapping="(item) => ({ value: item.title })"):
33
+ ms.Div(elem_style=dict(padding="0 16px"))
34
+
35
+ if __name__ == "__main__":
36
+ demo.queue().launch()
components/antd/listy/demos/item_render_function.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import modelscope_studio.components.antd as antd
3
+ import modelscope_studio.components.base as ms
4
+
5
+ items = [{
6
+ "id": i,
7
+ "title": f"Item {i}",
8
+ } for i in range(1000)]
9
+
10
+ with gr.Blocks() as demo:
11
+ with ms.Application():
12
+ with antd.ConfigProvider():
13
+ # both `row_key` and `item_render` accept a Javascript function string
14
+ antd.Listy(
15
+ items=items,
16
+ row_key="(item) => item.id",
17
+ item_render="(item, index) => `#${index} ${item.title}`",
18
+ height=360,
19
+ virtual=True,
20
+ elem_style=dict(border="1px solid #f0f0f0", borderRadius=8))
21
+
22
+ if __name__ == "__main__":
23
+ demo.queue().launch()
components/antdx/folder/README-zh_CN.md CHANGED
@@ -5,3 +5,4 @@ A folder tree component for displaying file structures. See [Ant Design X](https
5
  ## Examples
6
 
7
  <demo name="basic" position="bottom" collapsible="true"></demo>
 
 
5
  ## Examples
6
 
7
  <demo name="basic" position="bottom" collapsible="true"></demo>
8
+ <demo name="context_menu" title="Context Menu" position="bottom" collapsible="true"></demo>
components/antdx/folder/README.md CHANGED
@@ -5,3 +5,4 @@ A folder tree component for displaying file structures. See [Ant Design X](https
5
  ## Examples
6
 
7
  <demo name="basic" position="bottom" collapsible="true"></demo>
 
 
5
  ## Examples
6
 
7
  <demo name="basic" position="bottom" collapsible="true"></demo>
8
+ <demo name="context_menu" title="Context Menu" position="bottom" collapsible="true"></demo>
components/antdx/folder/demos/context_menu.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import modelscope_studio.components.antd as antd
3
+ import modelscope_studio.components.antdx as antdx
4
+ import modelscope_studio.components.base as ms
5
+
6
+
7
+ def on_right_click(e: gr.EventData):
8
+ print("right clicked:", e._data["payload"])
9
+
10
+
11
+ with gr.Blocks() as demo:
12
+ with ms.Application():
13
+ with antdx.XProvider():
14
+ antd.Divider("Shared Context Menu")
15
+ # `context_menu` applies to all nodes, a node can override it
16
+ # with its own `context_menu` (pass False to disable).
17
+ with antdx.Folder(default_expand_all=True,
18
+ context_menu=[{
19
+ "key": "rename",
20
+ "label": "Rename"
21
+ }, {
22
+ "key": "delete",
23
+ "label": "Delete",
24
+ "danger": True
25
+ }]) as folder:
26
+ with antdx.Folder.TreeNode(title="src", path="/src"):
27
+ antdx.Folder.TreeNode(title="index.ts",
28
+ path="/src/index.ts",
29
+ content="export * from './app';")
30
+ # disable the context menu for this node only
31
+ antdx.Folder.TreeNode(title="app.ts",
32
+ path="/src/app.ts",
33
+ content="console.log('Hello');",
34
+ context_menu=False)
35
+ antdx.Folder.TreeNode(
36
+ title="package.json",
37
+ path="/package.json",
38
+ content='{\n "name": "my-project"\n}',
39
+ # override the shared menu for this node
40
+ context_menu=[{
41
+ "key": "copy_path",
42
+ "label": "Copy Path"
43
+ }])
44
+
45
+ antd.Divider("Dynamic Context Menu")
46
+ # `context_menu` also accepts a Javascript function string,
47
+ # which receives the node data and its full path key.
48
+ antdx.Folder(
49
+ default_expand_all=True,
50
+ context_menu=
51
+ "(node, key) => node.children ? [{ key: 'new_file', label: 'New File' }] : [{ key: 'open', label: 'Open ' + key }]",
52
+ tree_data=[{
53
+ "title":
54
+ "project",
55
+ "path":
56
+ "/project",
57
+ "children": [{
58
+ "title": "main.py",
59
+ "path": "/project/main.py",
60
+ "content": "print('Hello, World!')"
61
+ }]
62
+ }])
63
+
64
+ folder.right_click(fn=on_right_click)
65
+
66
+ if __name__ == "__main__":
67
+ demo.queue().launch()
helper/Site.py CHANGED
@@ -250,8 +250,8 @@ class Site:
250
  screen_width = e._data["screen"][
251
  "width"]
252
  return gr.update(
253
- default_size=82 if screen_width <
254
- 576 else 213)
255
 
256
  app.mount(on_app_mount,
257
  outputs=[sider_panel])
 
250
  screen_width = e._data["screen"][
251
  "width"]
252
  return gr.update(
253
+ size=82 if screen_width <
254
+ 576 else None)
255
 
256
  app.mount(on_app_mount,
257
  outputs=[sider_panel])
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
  gradio==6.8.0
2
- modelscope_studio==2.0.2
3
  openai
 
1
  gradio==6.8.0
2
+ modelscope_studio==2.1.0
3
  openai
src/pyproject.toml CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "modelscope_studio"
11
- version = "2.0.2"
12
  description = "A third-party component library based on Gradio."
13
  readme = "README.md"
14
  license = "Apache-2.0"
 
8
 
9
  [project]
10
  name = "modelscope_studio"
11
+ version = "2.1.0"
12
  description = "A third-party component library based on Gradio."
13
  readme = "README.md"
14
  license = "Apache-2.0"