File size: 828 Bytes
d9a1ed0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
30
import gradio as gr

def process_json(json_data):
    # Function implementation to process the JSON data
    # You can replace this with your actual logic
    return f"Processed JSON data: {json_data}"

def launch_demo():
    input_text = gr.inputs.Textbox(label="Enter JSON data")

    def submit_json(json_data):
        result = process_json(json_data)
        return result

    examples = [
        ["{\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}"],
        ["{\"name\": \"Emily\", \"age\": 25, \"city\": \"San Francisco\"}"],
    ]

    gr.Interface(
        fn=submit_json,
        inputs=input_text,
        outputs="text",
        examples=examples,
        title="JSON Processor",
        description="Enter JSON data and click Submit to process it.",
        theme="default",
    ).launch()

launch_demo()