Spaces:
Runtime error
Runtime error
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() |