File size: 853 Bytes
6af7472
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
import modelscope_studio.components.antd as antd
import modelscope_studio.components.base as ms

items = [{
    "key": f"item-{i}",
    "title": f"Item {i}",
} for i in range(2000)]

with gr.Blocks() as demo:
    with ms.Application():
        with antd.ConfigProvider():
            with antd.Listy(items=items,
                            row_key="key",
                            height=360,
                            virtual=True,
                            elem_style=dict(border="1px solid #f0f0f0",
                                            borderRadius=8)):
                with ms.Slot(
                        "itemRender",
                        params_mapping="(item) => ({ value: item.title })"):
                    ms.Div(elem_style=dict(padding="0 16px"))

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