Spaces:
Running
Running
File size: 602 Bytes
ec765f7 87b98d4 ec765f7 87b98d4 ca823ee 87b98d4 beae3a1 87b98d4 ec765f7 87b98d4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
import json
def process_geojson(file):
if file is None:
return {}
try:
with open(file, 'r', encoding='utf-8') as f:
return json.load(f)
except Exception as e:
return {"error": str(e)}
with gr.Blocks() as ui:
with gr.Row():
with gr.Column():
file_input = gr.File(file_types=[".geojson"])
submit_btn = gr.Button("Submit")
with gr.Column():
output = gr.JSON()
submit_btn.click(process_geojson, file_input, output)
ui.launch(server_name="0.0.0.0", server_port=7860) |