Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,9 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
demo=gr.Blocks()
|
| 3 |
with demo:
|
| 4 |
gr.Markdown("# <center>图表渲染测试")
|
|
@@ -15,4 +20,8 @@ myChart.setOption(option);
|
|
| 15 |
</html>
|
| 16 |
'''
|
| 17 |
gr.HTML(htmls)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
def pd_bar():
|
| 4 |
+
df = pd.DataFrame({'lab':['A', 'B', 'C'], 'val':[10, 30, 20]})
|
| 5 |
+
ax = df.plot.bar(x='lab', y='val', rot=0)
|
| 6 |
+
return ax
|
| 7 |
demo=gr.Blocks()
|
| 8 |
with demo:
|
| 9 |
gr.Markdown("# <center>图表渲染测试")
|
|
|
|
| 20 |
</html>
|
| 21 |
'''
|
| 22 |
gr.HTML(htmls)
|
| 23 |
+
with gr.tab('pd_bar'):
|
| 24 |
+
pd_button=gr.Button("pd_bar>>")
|
| 25 |
+
pd_output=gr.Plot(label="pd_chart1")
|
| 26 |
+
pd_button.click(pd_bar, inputs=[], outputs=pd_output)
|
| 27 |
demo.launch()
|