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=(
|
72 |
|
73 |
# Plot the confusion matrix with a dark-mode compatible colormap
|
74 |
sns.heatmap(cm, cmap="magma", cbar=True, linecolor='white')
|
@@ -77,11 +77,11 @@ 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=
|
84 |
-
plt.xlabel('Predicted label', color="white", fontsize=
|
85 |
plt.tight_layout()
|
86 |
|
87 |
# Save the plot as an image
|
@@ -476,8 +476,8 @@ with gr.Blocks(css="""
|
|
476 |
task_complexity_dropdown = gr.Dropdown(label="Task Complexity (Number of Beams)", choices=[16, 32, 64, 128, 256], value=16)
|
477 |
|
478 |
with gr.Row():
|
479 |
-
raw_img_bp = gr.Image(label="Raw Channels", type="pil", width=300, height=
|
480 |
-
embeddings_img_bp = gr.Image(label="Embeddings", type="pil", width=300, height=
|
481 |
|
482 |
# Update the confusion matrices whenever sliders change
|
483 |
data_percentage_slider.change(fn=beam_prediction_task, inputs=[data_percentage_slider, task_complexity_dropdown], outputs=[raw_img_bp, embeddings_img_bp])
|
|
|
68 |
|
69 |
# Set dark mode styling
|
70 |
plt.style.use('dark_background')
|
71 |
+
plt.figure(figsize=(10, 10))
|
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=14) # White text for dark mode
|
81 |
+
plt.yticks(tick_marks, classes, color="white", fontsize=14) # White text for dark mode
|
82 |
|
83 |
+
plt.ylabel('True label', color="white", fontsize=14)
|
84 |
+
plt.xlabel('Predicted label', color="white", fontsize=14)
|
85 |
plt.tight_layout()
|
86 |
|
87 |
# Save the plot as an image
|
|
|
476 |
task_complexity_dropdown = gr.Dropdown(label="Task Complexity (Number of Beams)", choices=[16, 32, 64, 128, 256], value=16)
|
477 |
|
478 |
with gr.Row():
|
479 |
+
raw_img_bp = gr.Image(label="Raw Channels", type="pil", width=300, height=500)
|
480 |
+
embeddings_img_bp = gr.Image(label="Embeddings", type="pil", width=300, height=500)
|
481 |
|
482 |
# Update the confusion matrices whenever sliders change
|
483 |
data_percentage_slider.change(fn=beam_prediction_task, inputs=[data_percentage_slider, task_complexity_dropdown], outputs=[raw_img_bp, embeddings_img_bp])
|