changxin commited on
Commit
7ec74db
·
1 Parent(s): 4eef2d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import pandas as pd
3
  import pandas_bokeh
4
  import matplotlib.pyplot as plt
 
5
  #from pyg2plot import Plot
6
  #plt.rcParams['font.sans-serif']=['SimHei']
7
  #plt.rcParams['axes.unicode_minus']=False
@@ -28,6 +29,13 @@ def pd_bokeh():
28
  tt=df.plot_bokeh.bar(x='姓名',y='成绩',ylabel="群员吹水战绩",title="吹牛逼你们是认真的",alpha=0.6,figsize=(600,300),show_figure=False,legend="bottom_right")
29
  pandas_bokeh.save(tt)
30
  return 'test.html'
 
 
 
 
 
 
 
31
  #def pyg2plot_chart():
32
  # bar = Plot("Column")
33
  # bar.set_options({"height": 600,"width":800,"data": [{ "年": "2001", "销量": 3 },{ "年": "2002", "销量": 4 },{ "年": "2003", "销量": 5.5 },{"年": "2004", "销量": 7 },{ "年": "2005", "销量": 8.9 },{ "年": "2006", "销量": 10}],"xField": "年","yField": "销量","label": {}})
@@ -52,6 +60,10 @@ with demo:
52
  bokeh_button=gr.Button("pd_bokeh>>")
53
  bokeh_output=gr.File(label="bokeh_chart")
54
  bokeh_button.click(pd_bokeh, inputs=[], outputs=bokeh_output)
 
 
 
 
55
  # with gr.TabItem("pyg2plot"):
56
  # pyg2_button=gr.Button("pyg2plot>>")
57
  # pyg2_output=gr.Plot(label="pyg2plot_chart")
 
2
  import pandas as pd
3
  import pandas_bokeh
4
  import matplotlib.pyplot as plt
5
+ from pyecharts import Pie
6
  #from pyg2plot import Plot
7
  #plt.rcParams['font.sans-serif']=['SimHei']
8
  #plt.rcParams['axes.unicode_minus']=False
 
29
  tt=df.plot_bokeh.bar(x='姓名',y='成绩',ylabel="群员吹水战绩",title="吹牛逼你们是认真的",alpha=0.6,figsize=(600,300),show_figure=False,legend="bottom_right")
30
  pandas_bokeh.save(tt)
31
  return 'test.html'
32
+ def pyecharts1():
33
+ attr = ["吹水", "扯淡", "踢皮球", "吃鸡", "薅羊毛", "羊了个羊"]
34
+ v1 = [11, 12, 13, 10, 10, 10]
35
+ pie = Pie("吹牛逼我们是认真的")
36
+ pie.add("", attr, v1, is_label_show=True)
37
+ pie.render('test.html')
38
+ return 'test.html'
39
  #def pyg2plot_chart():
40
  # bar = Plot("Column")
41
  # bar.set_options({"height": 600,"width":800,"data": [{ "年": "2001", "销量": 3 },{ "年": "2002", "销量": 4 },{ "年": "2003", "销量": 5.5 },{"年": "2004", "销量": 7 },{ "年": "2005", "销量": 8.9 },{ "年": "2006", "销量": 10}],"xField": "年","yField": "销量","label": {}})
 
60
  bokeh_button=gr.Button("pd_bokeh>>")
61
  bokeh_output=gr.File(label="bokeh_chart")
62
  bokeh_button.click(pd_bokeh, inputs=[], outputs=bokeh_output)
63
+ with gr.TabItem("pyecharts"):
64
+ ehc_button=gr.Button("pyecharts>>")
65
+ ehc_output=gr.File(label="pyecharts_chart")
66
+ ehc_button.click(pyecharts1, inputs=[], outputs=ehc_output)
67
  # with gr.TabItem("pyg2plot"):
68
  # pyg2_button=gr.Button("pyg2plot>>")
69
  # pyg2_output=gr.Plot(label="pyg2plot_chart")