Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import matplotlib.pyplot as plt
|
|
|
|
| 4 |
#plt.rcParams['font.sans-serif']=['SimHei']
|
| 5 |
#plt.rcParams['axes.unicode_minus']=False
|
| 6 |
def pd_bar():
|
|
@@ -22,7 +23,11 @@ def pd_bokeh():
|
|
| 22 |
from bokeh.plotting import figure,show
|
| 23 |
p = figure(title="吹牛逼你是认真的", plot_width=800, plot_height=600)
|
| 24 |
p.circle([1, 2], [3, 4])
|
| 25 |
-
return p
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
demo=gr.Blocks()
|
| 27 |
with demo:
|
| 28 |
gr.Markdown("# <center>图表渲染测试")
|
|
@@ -43,6 +48,10 @@ with demo:
|
|
| 43 |
bokeh_button=gr.Button("pd_bokeh>>")
|
| 44 |
bokeh_output=gr.Plot(label="bokeh_chart")
|
| 45 |
bokeh_button.click(pd_bokeh, inputs=[], outputs=bokeh_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
with gr.TabItem("echarts"):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import matplotlib.pyplot as plt
|
| 4 |
+
#from pyg2plot import Plot
|
| 5 |
#plt.rcParams['font.sans-serif']=['SimHei']
|
| 6 |
#plt.rcParams['axes.unicode_minus']=False
|
| 7 |
def pd_bar():
|
|
|
|
| 23 |
from bokeh.plotting import figure,show
|
| 24 |
p = figure(title="吹牛逼你是认真的", plot_width=800, plot_height=600)
|
| 25 |
p.circle([1, 2], [3, 4])
|
| 26 |
+
return p
|
| 27 |
+
#def pyg2plot_chart():
|
| 28 |
+
# bar = Plot("Column")
|
| 29 |
+
# 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": {}})
|
| 30 |
+
# return bar.render_html()
|
| 31 |
demo=gr.Blocks()
|
| 32 |
with demo:
|
| 33 |
gr.Markdown("# <center>图表渲染测试")
|
|
|
|
| 48 |
bokeh_button=gr.Button("pd_bokeh>>")
|
| 49 |
bokeh_output=gr.Plot(label="bokeh_chart")
|
| 50 |
bokeh_button.click(pd_bokeh, inputs=[], outputs=bokeh_output)
|
| 51 |
+
# with gr.TabItem("pyg2plot"):
|
| 52 |
+
# pyg2_button=gr.Button("pyg2plot>>")
|
| 53 |
+
# pyg2_output=gr.Plot(label="pyg2plot_chart")
|
| 54 |
+
# pyg2_button.click(pyg2plot_chart, inputs=[], outputs=pyg2_output)
|
| 55 |
|
| 56 |
|
| 57 |
with gr.TabItem("echarts"):
|