EzekielMW commited on
Commit
019a86b
·
verified ·
1 Parent(s): e687465

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -155,10 +155,12 @@ clf_report = classification_report(all_labels, all_preds, target_names=class_nam
155
  def describe_model():
156
  fig, axes = plt.subplots(2, 1, figsize=(8, 10))
157
 
 
158
  sns.heatmap(conf_mat, annot=True, fmt='d', cmap='Blues',
159
  xticklabels=class_names, yticklabels=class_names, ax=axes[0])
160
  axes[0].set_title("Confusion Matrix")
161
 
 
162
  images, labels = next(iter(val_loader))
163
  outputs = model(images.to(device))
164
  _, preds = torch.max(outputs, 1)
@@ -169,11 +171,12 @@ def describe_model():
169
  axes[1].set_title("Sample Predictions: " + " | ".join([class_names[p.item()] for p in preds[:8]]))
170
  axes[1].axis('off')
171
 
172
- dims_summary = f"Image sizes (sampled): {list(set(image_shapes))}"
173
- summary = "\n".join(epoch_logs) + "\n\n" + dims_summary
174
 
175
  return fig, summary + "\n\n" + clf_report
176
 
 
177
  def predict_image(img):
178
  img = img.convert("RGB")
179
  transform_pred = transforms.Compose([
 
155
  def describe_model():
156
  fig, axes = plt.subplots(2, 1, figsize=(8, 10))
157
 
158
+ # Confusion Matrix
159
  sns.heatmap(conf_mat, annot=True, fmt='d', cmap='Blues',
160
  xticklabels=class_names, yticklabels=class_names, ax=axes[0])
161
  axes[0].set_title("Confusion Matrix")
162
 
163
+ # Show sample predictions
164
  images, labels = next(iter(val_loader))
165
  outputs = model(images.to(device))
166
  _, preds = torch.max(outputs, 1)
 
171
  axes[1].set_title("Sample Predictions: " + " | ".join([class_names[p.item()] for p in preds[:8]]))
172
  axes[1].axis('off')
173
 
174
+ # Summary (without image_shapes)
175
+ summary = "\n".join(epoch_logs)
176
 
177
  return fig, summary + "\n\n" + clf_report
178
 
179
+
180
  def predict_image(img):
181
  img = img.convert("RGB")
182
  transform_pred = transforms.Compose([