Daniel1213 commited on
Commit
7732269
1 Parent(s): aade525

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import xyzservices.providers as xyz
3
+ from bokeh.plotting import figure
4
+ from bokeh.tile_providers import get_provider
5
+ from bokeh.models import ColumnDataSource, Whisker
6
+ from bokeh.plotting import figure
7
+ from bokeh.sampledata.autompg2 import autompg2 as df
8
+ from bokeh.sampledata.penguins import data
9
+ from bokeh.transform import factor_cmap, jitter, factor_mark
10
+
11
+
12
+ def get_plot(plot_type):
13
+
14
+ plot = figure(
15
+ x_range=(-2000000, 6000000),
16
+ y_range=(-1000000, 7000000),
17
+ x_axis_type="mercator",
18
+ y_axis_type="mercator",
19
+ )
20
+ plot.scatter(x=[1,2,3,4], y=[2,4,5,6])
21
+ return plot
22
+
23
+
24
+ with gr.Blocks() as demo:
25
+ with gr.Row():
26
+ plot_type = gr.Radio(value="scatter", choices=["scatter", "whisker", "map"])
27
+ plot = gr.Plot()
28
+ plot_type.change(get_plot, inputs=[plot_type], outputs=[plot])
29
+ demo.load(get_plot, inputs=[plot_type], outputs=[plot])
30
+
31
+
32
+ demo.launch()