Spaces:
Runtime error
Runtime error
Denver Citizen9
commited on
Commit
·
d9a1ed0
1
Parent(s):
50b7644
updated
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def process_json(json_data):
|
4 |
+
# Function implementation to process the JSON data
|
5 |
+
# You can replace this with your actual logic
|
6 |
+
return f"Processed JSON data: {json_data}"
|
7 |
+
|
8 |
+
def launch_demo():
|
9 |
+
input_text = gr.inputs.Textbox(label="Enter JSON data")
|
10 |
+
|
11 |
+
def submit_json(json_data):
|
12 |
+
result = process_json(json_data)
|
13 |
+
return result
|
14 |
+
|
15 |
+
examples = [
|
16 |
+
["{\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}"],
|
17 |
+
["{\"name\": \"Emily\", \"age\": 25, \"city\": \"San Francisco\"}"],
|
18 |
+
]
|
19 |
+
|
20 |
+
gr.Interface(
|
21 |
+
fn=submit_json,
|
22 |
+
inputs=input_text,
|
23 |
+
outputs="text",
|
24 |
+
examples=examples,
|
25 |
+
title="JSON Processor",
|
26 |
+
description="Enter JSON data and click Submit to process it.",
|
27 |
+
theme="default",
|
28 |
+
).launch()
|
29 |
+
|
30 |
+
launch_demo()
|