Spaces:
Sleeping
Sleeping
Update cluster_insight.py
Browse files- cluster_insight.py +10 -0
cluster_insight.py
CHANGED
|
@@ -2,6 +2,16 @@
|
|
| 2 |
基于向量聚类方式的可视化模块
|
| 3 |
'''
|
| 4 |
# cluster_insight.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
import numpy as np
|
| 7 |
from sklearn.cluster import KMeans
|
|
|
|
| 2 |
基于向量聚类方式的可视化模块
|
| 3 |
'''
|
| 4 |
# cluster_insight.py
|
| 5 |
+
import subprocess
|
| 6 |
+
import sys
|
| 7 |
+
|
| 8 |
+
# 自动安装 Chrome(Spaces 容器专用)
|
| 9 |
+
try:
|
| 10 |
+
subprocess.check_call([sys.executable, '-m', 'plotly', 'get_chrome'])
|
| 11 |
+
print("Chrome 已自动安装!")
|
| 12 |
+
except Exception as e:
|
| 13 |
+
print(f"Chrome 安装失败:{e},尝试备用方案...")
|
| 14 |
+
|
| 15 |
import pandas as pd
|
| 16 |
import numpy as np
|
| 17 |
from sklearn.cluster import KMeans
|