Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for gradio for developing interactive web apps #1436

Merged
merged 2 commits into from
Feb 18, 2023
Merged

Conversation

giswqs
Copy link
Member

@giswqs giswqs commented Feb 18, 2023

import ee
import gradio as gr
import geemap.foliumap as geemap

def viz_dem(vmin, vmax, palette):

    Map = geemap.Map()
    image = ee.Image('USGS/SRTMGL1_003')
    vis_params = {
        'min': vmin,
        'max': vmax,
        'palette': palette,
    }
    Map.addLayer(image, vis_params, 'SRTM')
    return Map.to_gradio()

vmin = gr.Number(value=0, label="Min value")
vmax = gr.Number(value=6000, label="Max value")
palette = gr.Textbox(value="terrain", label="Palette")
title = 'Visualize Earth Engine Data'
demo = gr.Interface(viz_dem, [vmin, vmax, palette], "html", title=title)
demo.launch()

image

@giswqs giswqs changed the title Add support for gradio for developping interactive web apps Add support for gradio for developing interactive web apps Feb 18, 2023
@giswqs giswqs merged commit 7f1cd6a into master Feb 18, 2023
@giswqs giswqs deleted the gradio branch February 18, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant