Spaces:
Runtime error
Runtime error
Update app.py
Browse files245 unmodified lines2462472482492502512522 unmodified lines255256257258259260261245 unmodified linescam_alpha = (cam >= vis_threshold).astype(np.float32) * alpha # Alpha maskcam_rgba = np.dstack((cam_rgb, cam_alpha)) # Shape: (H, W, 4)# Resize CAM to match imagecam_pil = Image.fromarray((cam_rgba * 255).astype(np.uint8), mode="RGBA")cam_pil = cam_pil.resize((216,216), resample=Image.Resampling.NEAREST)2 unmodified linescam_pil = transforms.CenterCrop((h, w))(cam_pil)# Composite over originalcomposite = Image.alpha_composite(image_pil, cam_image)return composite245 unmodified lines2462472482492502512522 unmodified lines255256257258259260261245 unmodified linescam_alpha = (cam >= vis_threshold).astype(np.float32) * alpha # Alpha maskcam_rgba = np.dstack((cam_rgb, cam_alpha)) # Shape: (H, W, 4)# Coarse upscale for CAM output -- keeps "blocky" effect that is truer to what is measuredcam_pil = Image.fromarray((cam_rgba * 255).astype(np.uint8), mode="RGBA")cam_pil = cam_pil.resize((216,216), resample=Image.Resampling.NEAREST)2 unmodified linescam_pil = transforms.CenterCrop((h, w))(cam_pil)# Composite over originalcomposite = Image.alpha_composite(image_pil, cam_pil)return composite
app.py+2-2