JUNGU commited on
Commit
2baeed9
·
1 Parent(s): e37e7d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -42,13 +42,13 @@ def main():
42
  if data is not None:
43
  centroids, labels = apply_kmeans(data.values, k_value)
44
 
45
- plt.figure(figsize=(8, 8))
46
- plt.scatter(data['x'], data['y'], c=labels, cmap='viridis')
47
- plt.scatter(centroids[:, 0], centroids[:, 1], s=200, c='red', marker='X')
48
- plt.xlim(0, 100)
49
- plt.ylim(0, 100)
50
- plt.title(f"K-means clustering result for {dataset} Dataset (k={k_value})")
51
- st.pyplot()
52
 
53
  if __name__ == "__main__":
54
  main()
 
42
  if data is not None:
43
  centroids, labels = apply_kmeans(data.values, k_value)
44
 
45
+ fig, ax = plt.subplots(figsize=(8, 8))
46
+ ax.scatter(data['x'], data['y'], c=labels, cmap='viridis')
47
+ ax.scatter(centroids[:, 0], centroids[:, 1], s=200, c='red', marker='X')
48
+ ax.set_xlim(0, 100)
49
+ ax.set_ylim(0, 100)
50
+ ax.set_title(f"K-means clustering result for {dataset} Dataset (k={k_value})")
51
+ st.pyplot(fig)
52
 
53
  if __name__ == "__main__":
54
  main()