Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ def plot_confusion_matrix_beamPred(cm, classes, title, save_path):
|
|
68 |
|
69 |
# Set dark mode styling
|
70 |
plt.style.use('dark_background')
|
71 |
-
plt.figure(figsize=(7, 7)
|
72 |
|
73 |
# Plot the confusion matrix with a dark-mode compatible colormap
|
74 |
sns.heatmap(cm, cmap="magma", cbar=True, linecolor='white')
|
@@ -77,15 +77,15 @@ def plot_confusion_matrix_beamPred(cm, classes, title, save_path):
|
|
77 |
plt.title(f"{title}\n(F1 Score: {avg_f1:.3f})", color="white", fontsize=14)
|
78 |
|
79 |
tick_marks = np.arange(len(classes))
|
80 |
-
plt.xticks(tick_marks, classes, color="white", fontsize=
|
81 |
-
plt.yticks(tick_marks, classes, color="white", fontsize=
|
82 |
|
83 |
plt.ylabel('True label', color="white", fontsize=12)
|
84 |
plt.xlabel('Predicted label', color="white", fontsize=12)
|
85 |
plt.tight_layout()
|
86 |
|
87 |
# Save the plot as an image
|
88 |
-
plt.savefig(save_path,
|
89 |
plt.close()
|
90 |
|
91 |
# Return the saved image
|
|
|
68 |
|
69 |
# Set dark mode styling
|
70 |
plt.style.use('dark_background')
|
71 |
+
plt.figure(figsize=(7, 7))
|
72 |
|
73 |
# Plot the confusion matrix with a dark-mode compatible colormap
|
74 |
sns.heatmap(cm, cmap="magma", cbar=True, linecolor='white')
|
|
|
77 |
plt.title(f"{title}\n(F1 Score: {avg_f1:.3f})", color="white", fontsize=14)
|
78 |
|
79 |
tick_marks = np.arange(len(classes))
|
80 |
+
plt.xticks(tick_marks, classes, color="white", fontsize=12) # White text for dark mode
|
81 |
+
plt.yticks(tick_marks, classes, color="white", fontsize=12) # White text for dark mode
|
82 |
|
83 |
plt.ylabel('True label', color="white", fontsize=12)
|
84 |
plt.xlabel('Predicted label', color="white", fontsize=12)
|
85 |
plt.tight_layout()
|
86 |
|
87 |
# Save the plot as an image
|
88 |
+
plt.savefig(save_path, transparent=True) # Use transparent to blend with the dark mode website
|
89 |
plt.close()
|
90 |
|
91 |
# Return the saved image
|