Spaces:
Running
Running
Download components/antd/listy/demos/basic.py from modelscope/modelscope-studio: direct link, hf CLI and curl.
- Browser
- Download file 853 Bytes
-
https://huggingface.co/spaces/modelscope/modelscope-studio/resolve/main/components/antd/listy/demos/basic.py
- Command line
-
hf download hf://spaces/modelscope/modelscope-studio/components/antd/listy/demos/basic.py
-
curl -L -o basic.py https://huggingface.co/spaces/modelscope/modelscope-studio/resolve/main/components/antd/listy/demos/basic.py
853 Bytes
| 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() | |