Update app.py
Browse files
app.py
CHANGED
@@ -49,8 +49,8 @@ def gradcam(img_create):
|
|
49 |
x_dec = TensorImage(dls_augmented.train.decode((x,))[0][0])
|
50 |
fig,ax = plt.subplots()
|
51 |
x_dec.show(ctx=ax)
|
52 |
-
ax.imshow(cam_map[1].detach().cpu(), alpha=0.6, extent=(0,
|
53 |
-
fig.savefig("gcam.jpg")
|
54 |
im=cv2.imread("gcam.jpg",1)
|
55 |
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
|
56 |
#im=np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='')
|
@@ -73,6 +73,6 @@ examples=["filibe-1-1.jpg",
|
|
73 |
"varna-1-1.jpg"]
|
74 |
|
75 |
|
76 |
-
demo = gr.Interface(fn=gradcam, inputs=image, outputs=[gr.inputs.Image(shape=(
|
77 |
|
78 |
demo.launch(inline=False)
|
|
|
49 |
x_dec = TensorImage(dls_augmented.train.decode((x,))[0][0])
|
50 |
fig,ax = plt.subplots()
|
51 |
x_dec.show(ctx=ax)
|
52 |
+
ax.imshow(cam_map[1].detach().cpu(), alpha=0.6, extent=(0,128,128,0), interpolation='bilinear', cmap='magma');
|
53 |
+
fig.savefig("gcam.jpg", dpi=199)
|
54 |
im=cv2.imread("gcam.jpg",1)
|
55 |
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
|
56 |
#im=np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='')
|
|
|
73 |
"varna-1-1.jpg"]
|
74 |
|
75 |
|
76 |
+
demo = gr.Interface(fn=gradcam, inputs=image, outputs=[gr.inputs.Image(shape=(128,128)), label], examples=examples)
|
77 |
|
78 |
demo.launch(inline=False)
|