gradio-pr-bot commited on
Commit
ce4cdce
·
verified ·
1 Parent(s): e6ea6d8

Upload folder using huggingface_hub

Browse files
demos/native_plots/bar_plot_demo.py CHANGED
@@ -98,14 +98,14 @@ def bar_plot_fn(display):
98
 
99
 
100
  with gr.Blocks() as bar_plot:
101
- with gr.Row():
102
- with gr.Column():
103
- display = gr.Dropdown(
104
- choices=["simple", "stacked", "grouped", "simple-horizontal", "stacked-horizontal", "grouped-horizontal"],
105
- value="simple",
106
- label="Type of Bar Plot"
107
- )
108
- with gr.Column():
109
- plot = gr.BarPlot(show_label=False, show_actions_button=True)
110
  display.change(bar_plot_fn, inputs=display, outputs=plot)
111
  bar_plot.load(fn=bar_plot_fn, inputs=display, outputs=plot)
 
 
 
 
98
 
99
 
100
  with gr.Blocks() as bar_plot:
101
+ display = gr.Dropdown(
102
+ choices=["simple", "stacked", "grouped", "simple-horizontal", "stacked-horizontal", "grouped-horizontal"],
103
+ value="simple",
104
+ label="Type of Bar Plot"
105
+ )
106
+ plot = gr.BarPlot(show_label=False)
 
 
 
107
  display.change(bar_plot_fn, inputs=display, outputs=plot)
108
  bar_plot.load(fn=bar_plot_fn, inputs=display, outputs=plot)
109
+
110
+ if __name__ == "__main__":
111
+ bar_plot.launch()
demos/native_plots/line_plot_demo.py CHANGED
@@ -24,8 +24,6 @@ def line_plot_fn(dataset):
24
  overlay_point=False,
25
  title="Stock Prices",
26
  stroke_dash_legend_title=None,
27
- height=300,
28
- width=500
29
  )
30
  elif dataset == "climate":
31
  return gr.LinePlot(
@@ -40,8 +38,6 @@ def line_plot_fn(dataset):
40
  overlay_point=False,
41
  title="Climate",
42
  stroke_dash_legend_title=None,
43
- height=300,
44
- width=500
45
  )
46
  elif dataset == "seattle_weather":
47
  return gr.LinePlot(
@@ -56,8 +52,6 @@ def line_plot_fn(dataset):
56
  overlay_point=True,
57
  title="Seattle Weather",
58
  stroke_dash_legend_title=None,
59
- height=300,
60
- width=500
61
  )
62
  elif dataset == "gapminder":
63
  return gr.LinePlot(
@@ -72,20 +66,15 @@ def line_plot_fn(dataset):
72
  overlay_point=False,
73
  title="Life expectancy for countries",
74
  stroke_dash_legend_title="Country Cluster",
75
- height=300,
76
- width=500
77
  )
78
 
79
 
80
  with gr.Blocks() as line_plot:
81
- with gr.Row():
82
- with gr.Column():
83
- dataset = gr.Dropdown(
84
- choices=["stocks", "climate", "seattle_weather", "gapminder"],
85
- value="stocks",
86
- )
87
- with gr.Column():
88
- plot = gr.LinePlot()
89
  dataset.change(line_plot_fn, inputs=dataset, outputs=plot)
90
  line_plot.load(fn=line_plot_fn, inputs=dataset, outputs=plot)
91
 
 
24
  overlay_point=False,
25
  title="Stock Prices",
26
  stroke_dash_legend_title=None,
 
 
27
  )
28
  elif dataset == "climate":
29
  return gr.LinePlot(
 
38
  overlay_point=False,
39
  title="Climate",
40
  stroke_dash_legend_title=None,
 
 
41
  )
42
  elif dataset == "seattle_weather":
43
  return gr.LinePlot(
 
52
  overlay_point=True,
53
  title="Seattle Weather",
54
  stroke_dash_legend_title=None,
 
 
55
  )
56
  elif dataset == "gapminder":
57
  return gr.LinePlot(
 
66
  overlay_point=False,
67
  title="Life expectancy for countries",
68
  stroke_dash_legend_title="Country Cluster",
 
 
69
  )
70
 
71
 
72
  with gr.Blocks() as line_plot:
73
+ dataset = gr.Dropdown(
74
+ choices=["stocks", "climate", "seattle_weather", "gapminder"],
75
+ value="stocks",
76
+ )
77
+ plot = gr.LinePlot()
 
 
 
78
  dataset.change(line_plot_fn, inputs=dataset, outputs=plot)
79
  line_plot.load(fn=line_plot_fn, inputs=dataset, outputs=plot)
80
 
demos/native_plots/scatter_plot_demo.py CHANGED
@@ -12,13 +12,14 @@ def scatter_plot_fn(dataset):
12
  value=iris,
13
  x="petalWidth",
14
  y="petalLength",
15
- color="species",
16
  title="Iris Dataset",
17
- color_legend_title="Species",
18
  x_title="Petal Width",
19
  y_title="Petal Length",
20
  tooltip=["petalWidth", "petalLength", "species"],
21
  caption="",
 
 
22
  )
23
  else:
24
  return gr.ScatterPlot(
@@ -29,17 +30,15 @@ def scatter_plot_fn(dataset):
29
  tooltip="Name",
30
  title="Car Data",
31
  y_title="Miles per Gallon",
32
- color_legend_title="Origin of Car",
33
  caption="MPG vs Horsepower of various cars",
 
 
34
  )
35
 
36
 
37
  with gr.Blocks() as scatter_plot:
38
- with gr.Row():
39
- with gr.Column():
40
- dataset = gr.Dropdown(choices=["cars", "iris"], value="cars")
41
- with gr.Column():
42
- plot = gr.ScatterPlot(show_label=False)
43
  dataset.change(scatter_plot_fn, inputs=dataset, outputs=plot)
44
  scatter_plot.load(fn=scatter_plot_fn, inputs=dataset, outputs=plot)
45
 
 
12
  value=iris,
13
  x="petalWidth",
14
  y="petalLength",
15
+ color=None,
16
  title="Iris Dataset",
 
17
  x_title="Petal Width",
18
  y_title="Petal Length",
19
  tooltip=["petalWidth", "petalLength", "species"],
20
  caption="",
21
+ height=600,
22
+ width=600,
23
  )
24
  else:
25
  return gr.ScatterPlot(
 
30
  tooltip="Name",
31
  title="Car Data",
32
  y_title="Miles per Gallon",
 
33
  caption="MPG vs Horsepower of various cars",
34
+ height=None,
35
+ width=None,
36
  )
37
 
38
 
39
  with gr.Blocks() as scatter_plot:
40
+ dataset = gr.Dropdown(choices=["cars", "iris"], value="cars")
41
+ plot = gr.ScatterPlot(show_label=False)
 
 
 
42
  dataset.change(scatter_plot_fn, inputs=dataset, outputs=plot)
43
  scatter_plot.load(fn=scatter_plot_fn, inputs=dataset, outputs=plot)
44
 
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
 
2
- gradio-client @ git+https://github.com/gradio-app/gradio@c24647db8266f2b67dd3d64f640a5641ee87ae13#subdirectory=client/python
3
- https://gradio-builds.s3.amazonaws.com/c24647db8266f2b67dd3d64f640a5641ee87ae13/gradio-4.36.1-py3-none-any.whl
4
  pypistats==1.1.0
5
  plotly==5.10.0
6
  opencv-python==4.6.0.66
 
1
 
2
+ gradio-client @ git+https://github.com/gradio-app/gradio@55253d40aa21eb5e2e2bfc66675bda14f8c91eda#subdirectory=client/python
3
+ https://gradio-builds.s3.amazonaws.com/55253d40aa21eb5e2e2bfc66675bda14f8c91eda/gradio-4.36.1-py3-none-any.whl
4
  pypistats==1.1.0
5
  plotly==5.10.0
6
  opencv-python==4.6.0.66