Spaces:
Runtime error
Runtime error
import gradio as gr | |
import xyzservices.providers as xyz | |
from bokeh.plotting import figure | |
from bokeh.tile_providers import get_provider | |
from bokeh.models import ColumnDataSource, Whisker | |
from bokeh.plotting import figure | |
from bokeh.sampledata.autompg2 import autompg2 as df | |
from bokeh.sampledata.penguins import data | |
from bokeh.transform import factor_cmap, jitter, factor_mark | |
def get_plot(plot_type): | |
plot = figure( | |
x_range=(-2000000, 6000000), | |
y_range=(-1000000, 7000000), | |
x_axis_type="mercator", | |
y_axis_type="mercator", | |
) | |
plot.scatter(x=[1,2,3,4], y=[2,4,5,6]) | |
return plot | |
with gr.Blocks() as demo: | |
with gr.Row(): | |
plot_type = gr.Radio(value="scatter", choices=["scatter", "whisker", "map"]) | |
plot = gr.Plot() | |
plot_type.change(get_plot, inputs=[plot_type], outputs=[plot]) | |
demo.load(get_plot, inputs=[plot_type], outputs=[plot]) | |
demo.launch() |