Update app.py
Browse files
app.py
CHANGED
|
@@ -52,8 +52,9 @@ def gradcam(img_create):
|
|
| 52 |
fig,ax = plt.subplots()
|
| 53 |
x_dec.show(ctx=ax)
|
| 54 |
ax.imshow(cam_map[1].detach().cpu(), alpha=0.6, extent=(0,128,128,0), interpolation='bilinear', cmap='magma');
|
| 55 |
-
fig.savefig("gcam.jpg")
|
| 56 |
-
im=cv2.imread("gcam.jpg",1)
|
|
|
|
| 57 |
|
| 58 |
return dict(zip(categories, map(float, probs))), im
|
| 59 |
|
|
|
|
| 52 |
fig,ax = plt.subplots()
|
| 53 |
x_dec.show(ctx=ax)
|
| 54 |
ax.imshow(cam_map[1].detach().cpu(), alpha=0.6, extent=(0,128,128,0), interpolation='bilinear', cmap='magma');
|
| 55 |
+
#fig.savefig("gcam.jpg")
|
| 56 |
+
#im=cv2.imread("gcam.jpg",1)
|
| 57 |
+
im=np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='')
|
| 58 |
|
| 59 |
return dict(zip(categories, map(float, probs))), im
|
| 60 |
|