Spaces:
Runtime error
Runtime error
Improve UI: recommended model label, hover info, forestmap.ai branding
Browse files- Dropdown shows "Flexible (recommended)" with model descriptions
- Info tooltips on file upload, model picker, and confidence slider
- Header includes forestmap.ai credit, GitHub and paper links
Co-authored-by: Cursor <cursoragent@cursor.com>
182 unmodified lines183184185186187188189190191192193194188195196197198199200201202203204193194195205206207208209210211212213214215216217218219220221222223224182 unmodified lines out.append(p) return "\n".join(sorted(out)) or "(empty)"
# Model display names with descriptions for dropdownMODEL_CHOICES = [ ("Flexible (recommended)", "Flexible"), ("Forest – tropical closed canopy", "Forest"), ("Urban – city & suburban trees", "Urban"),]
# gradio uiwith gr.Blocks(title="Detectree2 – Landscape Prediction") as demo: gr.Markdown("# Detectree2\nModels load from `/data/weights` (persistent).") gr.Markdown( "# Detectree2\n" "Upload aerial RGB imagery as a GeoTIFF and get automatic tree crown delineations. " "Supported by [forestmap.ai](https://forestmap.ai). " "[GitHub](https://github.com/PatBall1/detectree2) · [Paper](https://doi.org/10.1002/rse2.332)" )
with gr.Tabs(): with gr.Tab("Predict"): with gr.Row(): inp_file = gr.File(label="Input (.tif / .tiff)", file_types=[".tif", ".tiff"], type="filepath") env_dd = gr.Dropdown(label="Environment", choices=list(WEIGHTS.keys()), value=DEFAULT_ENV) conf = gr.Slider(0.0, 1.0, value=0.5, step=0.05, label="Confidence threshold") inp_file = gr.File( label="Input (.tif / .tiff)", file_types=[".tif", ".tiff"], type="filepath", info="Upload a georeferenced GeoTIFF with CRS and transform. RGB bands required." ) env_dd = gr.Dropdown( label="Model", choices=MODEL_CHOICES, value=DEFAULT_ENV, info="Flexible works across forests and urban areas. Use Forest or Urban for specialised accuracy." ) conf = gr.Slider( 0.0, 1.0, value=0.5, step=0.05, label="Confidence threshold", info="Lower values detect more trees but may include false positives." ) run_btn = gr.Button("Run prediction", variant="primary")
out_img = gr.Image(label="Overlay (PNG)", type="filepath")app.py+30-4