gradio/demo/json_component/run.py
aliabid94 9b42ba8f10
Update guides esp plots (#8907)
* changes

* changes

* revert changes

* changes

* add changeset

* notebooks script

* changes

* changes

---------

Co-authored-by: Ali Abid <aliabid94@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
2024-07-29 22:08:51 -07:00

25 lines
625 B
Python

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()