siyuansc commited on
Commit
65b2e95
1 Parent(s): 4af4b06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import json
2
  from collections import Counter
3
  import numpy as np
@@ -8,6 +9,8 @@ import operator
8
  import warnings
9
  warnings.filterwarnings('ignore')
10
 
 
 
11
  # loading the events data
12
  events={}
13
  nations = ['Italy','England','Germany','France','Spain','European_Championship','World_Cup']
@@ -135,3 +138,19 @@ combined_chart1 = alt.hconcat(
135
  )
136
  combined_chart1
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import panel as pn
2
  import json
3
  from collections import Counter
4
  import numpy as np
 
9
  import warnings
10
  warnings.filterwarnings('ignore')
11
 
12
+ pn.extension('vega')
13
+
14
  # loading the events data
15
  events={}
16
  nations = ['Italy','England','Germany','France','Spain','European_Championship','World_Cup']
 
138
  )
139
  combined_chart1
140
 
141
+ chart1_panel = pn.pane.Vega(chart1, sizing_mode='stretch_width')
142
+ chart2_panel = pn.pane.Vega(chart2, sizing_mode='stretch_width')
143
+
144
+ dashboard = pn.Column(
145
+ "# My Interactive Dashboard", # 可以添加标题
146
+ chart1_panel,
147
+ chart2_panel
148
+ )
149
+
150
+ # 设置应用程序为可服务的
151
+ dashboard.servable(title='My Hugging Face Space Dashboard')
152
+
153
+ # 如果你运行这个脚本,那么调用以下命令可以在本地启动服务器
154
+ if __name__.startswith('bokeh'):
155
+ dashboard.show(port=12345) # 在指定的端口上启动 Panel 应用程序
156
+ dashboard.servable()‘的代码