Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import pandas_bokeh
|
| 4 |
-
import matplotlib.pyplot as plt
|
| 5 |
import seaborn as sns
|
| 6 |
from highcharts import Highchart
|
| 7 |
from pyecharts.charts import Bar
|
|
@@ -64,6 +64,11 @@ def pyhighchats():
|
|
| 64 |
H.add_data_set(data,'line')
|
| 65 |
H.save_file('test.html')
|
| 66 |
return 'test.html'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
demo=gr.Blocks()
|
| 69 |
with demo:
|
|
@@ -109,6 +114,10 @@ with demo:
|
|
| 109 |
pyhc_button=gr.Button("pyhc>>")
|
| 110 |
pyhc_output=gr.File(label="pyhc_chart")
|
| 111 |
pyhc_button.click(pyhighchats, inputs=[], outputs=pyhc_output,api_name='pyhcharts')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
with gr.TabItem("echarts"):
|
| 114 |
htmls='''
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import pandas_bokeh
|
| 4 |
+
import matplotlib.pyplot as plt,mpld3
|
| 5 |
import seaborn as sns
|
| 6 |
from highcharts import Highchart
|
| 7 |
from pyecharts.charts import Bar
|
|
|
|
| 64 |
H.add_data_set(data,'line')
|
| 65 |
H.save_file('test.html')
|
| 66 |
return 'test.html'
|
| 67 |
+
def d3_js():
|
| 68 |
+
fig=plt.figure()
|
| 69 |
+
obj,=plt.plot([3,1,4,1,5])
|
| 70 |
+
mpld3.save_html(fig,"test.html")
|
| 71 |
+
return 'test.html'
|
| 72 |
|
| 73 |
demo=gr.Blocks()
|
| 74 |
with demo:
|
|
|
|
| 114 |
pyhc_button=gr.Button("pyhc>>")
|
| 115 |
pyhc_output=gr.File(label="pyhc_chart")
|
| 116 |
pyhc_button.click(pyhighchats, inputs=[], outputs=pyhc_output,api_name='pyhcharts')
|
| 117 |
+
with gr.TabItem("d3JS"):
|
| 118 |
+
d3_button=gr.Button("D3JS>>")
|
| 119 |
+
d3_output=gr.File(label="D3_chart")
|
| 120 |
+
d3_button.click(d3_js, inputs=[], outputs=d3_output,api_name='d3_js')
|
| 121 |
|
| 122 |
with gr.TabItem("echarts"):
|
| 123 |
htmls='''
|