66 gradio
In [1]:
Copied!
# !pip install -U leafmap
# !pip install -U leafmap
Folium backend¶
In [2]:
Copied!
import gradio as gr
import leafmap.foliumap as leafmap
def split(left, right):
m = leafmap.Map()
m.split_map(left_layer=left, right_layer=right)
return m.to_gradio()
left_url = 'https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif'
right_url = 'https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-14/pine-gulch-fire20/10300100AAC8DD00.tif'
left_input = gr.Textbox(value=left_url, label="Left Layer URL")
right_input = gr.Textbox(value=right_url, label="Right Layer URL")
demo = gr.Interface(split, [left_input, right_input], "html")
# demo.launch()
import gradio as gr
import leafmap.foliumap as leafmap
def split(left, right):
m = leafmap.Map()
m.split_map(left_layer=left, right_layer=right)
return m.to_gradio()
left_url = 'https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif'
right_url = 'https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-14/pine-gulch-fire20/10300100AAC8DD00.tif'
left_input = gr.Textbox(value=left_url, label="Left Layer URL")
right_input = gr.Textbox(value=right_url, label="Right Layer URL")
demo = gr.Interface(split, [left_input, right_input], "html")
# demo.launch()
Plotly backend¶
In [3]:
Copied!
import gradio as gr
import leafmap.plotlymap as leafmap
def viz_cog(url):
m = leafmap.Map()
m.add_cog_layer(url)
return m
url = 'https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif'
demo = gr.Interface(
fn=viz_cog,
inputs=gr.Text(value=url, label='Enter a COG URL'),
outputs=gr.Plot().style(),
)
# demo.launch()
import gradio as gr
import leafmap.plotlymap as leafmap
def viz_cog(url):
m = leafmap.Map()
m.add_cog_layer(url)
return m
url = 'https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif'
demo = gr.Interface(
fn=viz_cog,
inputs=gr.Text(value=url, label='Enter a COG URL'),
outputs=gr.Plot().style(),
)
# demo.launch()
Last update:
2023-09-22
Created: 2023-09-22
Created: 2023-09-22