Lashtw commited on
Commit
6777840
·
verified ·
1 Parent(s): e772f7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -6,9 +6,16 @@ from zipfile import ZipFile
6
 
7
  try:
8
  import kaleido
 
9
  except ImportError:
10
  st.error("請安裝 'kaleido' 套件以啟用圖像導出功能:\n\n $ pip install kaleido")
11
 
 
 
 
 
 
 
12
 
13
  def load_data(uploaded_file):
14
  """載入並處理CSV檔案"""
@@ -96,7 +103,7 @@ def save_all_radar_charts(df, selected_columns, comparison_rows):
96
  )
97
 
98
  file_path = os.path.join(output_dir, f"{student}_comparison.png")
99
- fig.write_image(file_path, engine="kaleido") # Removed the unsupported font_family here.
100
 
101
  # 壓縮所有圖表
102
  zip_path = "radar_charts.zip"
 
6
 
7
  try:
8
  import kaleido
9
+ import plotly.io as pio
10
  except ImportError:
11
  st.error("請安裝 'kaleido' 套件以啟用圖像導出功能:\n\n $ pip install kaleido")
12
 
13
+ # set kaleido config if installed, to try and fix the chinese font issue
14
+ try:
15
+ pio.kaleido.scope.default_font = "Microsoft JhengHei, Noto Sans CJK, Arial"
16
+ except:
17
+ st.error("字型設定錯誤,請確定是否安裝 kaleido")
18
+
19
 
20
  def load_data(uploaded_file):
21
  """載入並處理CSV檔案"""
 
103
  )
104
 
105
  file_path = os.path.join(output_dir, f"{student}_comparison.png")
106
+ fig.write_image(file_path, engine="kaleido")
107
 
108
  # 壓縮所有圖表
109
  zip_path = "radar_charts.zip"