Spaces:
Running
Running
Download components/antd/alert/demos/basic.py from modelscope/modelscope-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/spaces/modelscope/modelscope-studio/resolve/main/components/antd/alert/demos/basic.py
- Command line
-
hf download hf://spaces/modelscope/modelscope-studio/components/antd/alert/demos/basic.py
-
curl -L -o basic.py https://huggingface.co/spaces/modelscope/modelscope-studio/resolve/main/components/antd/alert/demos/basic.py
1.24 kB
| import gradio as gr | |
| import modelscope_studio.components.antd as antd | |
| import modelscope_studio.components.base as ms | |
| data = [{ | |
| "message": "Success Text", | |
| "description": | |
| "Success Description Success Description Success Description Success Description", | |
| "type": "success" | |
| }, { | |
| "message": "Info Text", | |
| "description": | |
| "Info Description Info Description Info Description Info Description", | |
| "type": "info" | |
| }, { | |
| "message": "Warning Text", | |
| "description": | |
| "Warning Description Warning Description Warning Description Warning Description", | |
| "type": "warning" | |
| }, { | |
| "message": "Error Text", | |
| "description": | |
| "Error Description Error Description Error Description Error Description", | |
| "type": "error" | |
| }] | |
| with gr.Blocks() as demo: | |
| with ms.Application(): | |
| with antd.ConfigProvider(): | |
| with antd.Space(direction="vertical"): | |
| for item in data: | |
| antd.Alert(message=item["message"], | |
| description=item["description"], | |
| type=item["type"], | |
| closable=True, | |
| show_icon=True) | |
| if __name__ == "__main__": | |
| demo.queue().launch() | |