Spaces:
Sleeping
Sleeping
Download run.py from gradio/json_component_main: direct link, hf CLI and curl.
- Browser
- Download file 625 Bytes
-
https://huggingface.co/spaces/gradio/json_component_main/resolve/main/run.py
- Command line
-
hf download hf://spaces/gradio/json_component_main/run.py
-
curl -L -o run.py https://huggingface.co/spaces/gradio/json_component_main/resolve/main/run.py
625 Bytes
| import gradio as gr | |
| import numpy as np | |
| with gr.Blocks() as demo: | |
| inp = gr.JSON( | |
| label="InputJSON", | |
| value={ | |
| "Key 1": "Value 1", | |
| "Key 2": {"Key 3": "Value 2", "Key 4": "Value 3"}, | |
| "Key 5": ["Item 1", "Item 2", "Item 3"], | |
| "Key 6": 123, | |
| "Key 7": 123.456, | |
| "Key 8": True, | |
| "Key 9": False, | |
| "Key 10": None, | |
| "Key 11": np.array([1, 2, 3]), | |
| } | |
| ) | |
| out = gr.JSON(label="OutputJSON") | |
| btn = gr.Button("Submit") | |
| btn.click(lambda x: x, inp, out) | |
| if __name__ == "__main__": | |
| demo.launch() | |