wxy01giser commited on
Commit
c315a9a
·
verified ·
1 Parent(s): de3a936

Update cluster_insight.py

Browse files
Files changed (1) hide show
  1. cluster_insight.py +4 -2
cluster_insight.py CHANGED
@@ -281,7 +281,9 @@ def cluster_and_visualize(
281
  margin=dict(l=50, r=50, t=80, b=50) # 让 Plotly 内部也居中
282
  )
283
 
284
- # img_bytes = fig.to_image(format="png", width=900, height=600, scale=2 ) # 新增这一行!
 
 
285
  # 新代码:
286
  # img_bytes = pio.to_image(
287
  # fig,
@@ -291,7 +293,7 @@ def cluster_and_visualize(
291
  # scale=2
292
  # )
293
  # b64 = base64.b64encode(img_bytes).decode('utf-8')
294
- b64 = fig_to_base64(fig)
295
  # print(f"{b64}解析成功!")
296
  # return b64, stats
297
  return fig, b64, stats
 
281
  margin=dict(l=50, r=50, t=80, b=50) # 让 Plotly 内部也居中
282
  )
283
 
284
+ img_bytes = fig.to_image(format="png", width=900, height=600, scale=2,
285
+ engine='kaleido' ) # 新增这一行!
286
+ b64 = base64.b64encode(img_bytes).decode('utf-8')
287
  # 新代码:
288
  # img_bytes = pio.to_image(
289
  # fig,
 
293
  # scale=2
294
  # )
295
  # b64 = base64.b64encode(img_bytes).decode('utf-8')
296
+ # b64 = fig_to_base64(fig)
297
  # print(f"{b64}解析成功!")
298
  # return b64, stats
299
  return fig, b64, stats