Spaces:
Running
Running
Download components/base/auto_loading/demos/nested.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/base/auto_loading/demos/nested.py
- Command line
-
hf download hf://spaces/modelscope/modelscope-studio/components/base/auto_loading/demos/nested.py
-
curl -L -o nested.py https://huggingface.co/spaces/modelscope/modelscope-studio/resolve/main/components/base/auto_loading/demos/nested.py
1.24 kB
| import time | |
| import gradio as gr | |
| import modelscope_studio.components.antd as antd | |
| import modelscope_studio.components.base as ms | |
| def click(): | |
| time.sleep(2) | |
| yield gr.update(value="Hello"), gr.update(value="Hello") | |
| time.sleep(2) | |
| yield gr.update(value="Hello World"), gr.update(value="Hello World") | |
| def click2(): | |
| time.sleep(2) | |
| yield gr.update(value="Hello") | |
| with gr.Blocks() as demo: | |
| with ms.Application(): | |
| with antd.ConfigProvider(): | |
| with ms.AutoLoading(): | |
| with antd.Space(direction="vertical", | |
| elem_style=dict(width="100%")): | |
| with ms.AutoLoading(generating=True): | |
| textarea = antd.Input.Textarea() | |
| with ms.AutoLoading(show_mask=True): | |
| textarea2 = antd.Input.Textarea() | |
| textarea3 = antd.Input.Textarea() | |
| with antd.Space(): | |
| btn = antd.Button("Click") | |
| btn2 = antd.Button("Click2") | |
| btn.click(click, outputs=[textarea, textarea2]) | |
| btn2.click(click2, outputs=[textarea3]) | |
| if __name__ == "__main__": | |
| demo.queue().launch() | |