Update app.py
Browse files
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 pyecharts.charts import Bar
|
| 6 |
import cufflinks as cf
|
| 7 |
|
|
@@ -41,6 +42,14 @@ def cff():
|
|
| 41 |
df=pd.DataFrame([[0.2,0.4,0.6],[0.4,0.3,0.4],[0.4,0.5,0.2],[0.5,0.4,0.4]],columns=['a','b','c'])
|
| 42 |
cfft=df.iplot(kind='bubble',x='a',y='b',size='c')
|
| 43 |
return cfft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
#def pyg2plot_chart():
|
| 45 |
# bar = Plot("Column")
|
| 46 |
# 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": {}})
|
|
@@ -73,6 +82,10 @@ with demo:
|
|
| 73 |
cff_button=gr.Button("cufflinks>>")
|
| 74 |
cff_output=gr.File(label="cufflinks_chart")
|
| 75 |
cff_button.click(cff, inputs=[], outputs=cff_output,api_name='cuffl')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
# with gr.TabItem("pyg2plot"):
|
| 77 |
# pyg2_button=gr.Button("pyg2plot>>")
|
| 78 |
# pyg2_output=gr.Plot(label="pyg2plot_chart")
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import pandas_bokeh
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
+
import seaborn as sns
|
| 6 |
from pyecharts.charts import Bar
|
| 7 |
import cufflinks as cf
|
| 8 |
|
|
|
|
| 42 |
df=pd.DataFrame([[0.2,0.4,0.6],[0.4,0.3,0.4],[0.4,0.5,0.2],[0.5,0.4,0.4]],columns=['a','b','c'])
|
| 43 |
cfft=df.iplot(kind='bubble',x='a',y='b',size='c')
|
| 44 |
return cfft
|
| 45 |
+
def seab():
|
| 46 |
+
tips=sns.load_dataset('tips')
|
| 47 |
+
sns.set_style("whitegrid")
|
| 48 |
+
g=sns.lmplot(x="tip",y="total_bill",data=tips,aspect=2)
|
| 49 |
+
g=(g.set_axis_labels("Tip","Total bill(USD)") \
|
| 50 |
+
.set(xlim=(0,10),ylim=(0,100)))
|
| 51 |
+
plt.title("ๅน็้ผ")
|
| 52 |
+
return plt
|
| 53 |
#def pyg2plot_chart():
|
| 54 |
# bar = Plot("Column")
|
| 55 |
# 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": {}})
|
|
|
|
| 82 |
cff_button=gr.Button("cufflinks>>")
|
| 83 |
cff_output=gr.File(label="cufflinks_chart")
|
| 84 |
cff_button.click(cff, inputs=[], outputs=cff_output,api_name='cuffl')
|
| 85 |
+
with gr.TabItem("seaborn"):
|
| 86 |
+
sb_button=gr.Button("seaborn>>")
|
| 87 |
+
sb_output=gr.File(label="seaborn_chart")
|
| 88 |
+
sb_button.click(seab, inputs=[], outputs=sb_output,api_name='seaborn')
|
| 89 |
# with gr.TabItem("pyg2plot"):
|
| 90 |
# pyg2_button=gr.Button("pyg2plot>>")
|
| 91 |
# pyg2_output=gr.Plot(label="pyg2plot_chart")
|