chatfed_whisp / app.py
leavoigt's picture
add geojson upload
87b98d4
raw
history blame
602 Bytes
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)