test
Browse files
app.py
CHANGED
|
@@ -53,6 +53,7 @@ def predict(inp):
|
|
| 53 |
cam = GradCAM(model=model,
|
| 54 |
target_layers=target_layers)
|
| 55 |
img = ho_trans_center(image = inp)['image']
|
|
|
|
| 56 |
img = topt(image = img)['image']
|
| 57 |
img = img.unsqueeze(0)
|
| 58 |
with torch.no_grad():
|
|
@@ -67,7 +68,7 @@ def predict(inp):
|
|
| 67 |
grad = grad[0 :]
|
| 68 |
print(img.shape, img.dtype)
|
| 69 |
print(grad.shape, grad.dtype)
|
| 70 |
-
cam_image = show_cam_on_image(
|
| 71 |
return confidences,cam_image
|
| 72 |
|
| 73 |
import gradio as gr
|
|
|
|
| 53 |
cam = GradCAM(model=model,
|
| 54 |
target_layers=target_layers)
|
| 55 |
img = ho_trans_center(image = inp)['image']
|
| 56 |
+
rgb_img = img.copy()
|
| 57 |
img = topt(image = img)['image']
|
| 58 |
img = img.unsqueeze(0)
|
| 59 |
with torch.no_grad():
|
|
|
|
| 68 |
grad = grad[0 :]
|
| 69 |
print(img.shape, img.dtype)
|
| 70 |
print(grad.shape, grad.dtype)
|
| 71 |
+
cam_image = show_cam_on_image(rgb_img, grad)
|
| 72 |
return confidences,cam_image
|
| 73 |
|
| 74 |
import gradio as gr
|