Spaces:
Sleeping
Sleeping
Commit
·
73c7bab
1
Parent(s):
655a3f5
more typos
Browse files- cluster/plot.py +2 -5
cluster/plot.py
CHANGED
@@ -8,13 +8,11 @@ import os
|
|
8 |
matplotlib.use("Agg")
|
9 |
sns.set()
|
10 |
|
11 |
-
|
12 |
-
UPLOAD_FOLDER = "/plot"
|
13 |
|
14 |
|
15 |
def plot(clusterer, X) -> None:
|
16 |
cluster_data = clusterer.to_dict(X)["clusters"]
|
17 |
-
# plot the clusters and data points
|
18 |
fig, ax = plt.subplots(figsize=(8, 6))
|
19 |
for cluster in cluster_data:
|
20 |
sns.scatterplot(
|
@@ -36,9 +34,8 @@ def plot(clusterer, X) -> None:
|
|
36 |
ax.set_ylabel("Normalized Petal Length (cm)")
|
37 |
ax.set_xlabel("Normalized Petal Length (cm)")
|
38 |
|
39 |
-
image_key = generate_image_key()
|
40 |
|
41 |
-
# Save the plot as an image file with the key in the filename
|
42 |
plot_filename = os.path.join(UPLOAD_FOLDER, f"{image_key}.png")
|
43 |
fig.savefig(plot_filename, format="png")
|
44 |
plt.close(fig)
|
|
|
8 |
matplotlib.use("Agg")
|
9 |
sns.set()
|
10 |
|
11 |
+
UPLOAD_FOLDER = "/plots"
|
|
|
12 |
|
13 |
|
14 |
def plot(clusterer, X) -> None:
|
15 |
cluster_data = clusterer.to_dict(X)["clusters"]
|
|
|
16 |
fig, ax = plt.subplots(figsize=(8, 6))
|
17 |
for cluster in cluster_data:
|
18 |
sns.scatterplot(
|
|
|
34 |
ax.set_ylabel("Normalized Petal Length (cm)")
|
35 |
ax.set_xlabel("Normalized Petal Length (cm)")
|
36 |
|
37 |
+
image_key = generate_image_key()
|
38 |
|
|
|
39 |
plot_filename = os.path.join(UPLOAD_FOLDER, f"{image_key}.png")
|
40 |
fig.savefig(plot_filename, format="png")
|
41 |
plt.close(fig)
|