File size: 625 Bytes
d939940
 
ec1e319
7348088
d939940
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ec1e319
d939940
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()