Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,12 @@ import cv2
|
|
9 |
from pytorch_grad_cam import GradCAM
|
10 |
from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget
|
11 |
from pytorch_grad_cam.utils.image import show_cam_on_image
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
import warnings
|
13 |
warnings.filterwarnings("ignore")
|
14 |
|
@@ -76,10 +82,10 @@ def predict(input_image:Image.Image):
|
|
76 |
interface = gr.Interface(
|
77 |
fn=predict,
|
78 |
inputs=[
|
79 |
-
gr.
|
80 |
],
|
81 |
outputs=[
|
82 |
-
gr.
|
83 |
-
gr.
|
84 |
],
|
85 |
).launch()
|
|
|
9 |
from pytorch_grad_cam import GradCAM
|
10 |
from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget
|
11 |
from pytorch_grad_cam.utils.image import show_cam_on_image
|
12 |
+
import torch
|
13 |
+
import cv2
|
14 |
+
import numpy as np
|
15 |
+
from torchvision import transforms
|
16 |
+
from PIL import Image
|
17 |
+
import gradio as gr
|
18 |
import warnings
|
19 |
warnings.filterwarnings("ignore")
|
20 |
|
|
|
82 |
interface = gr.Interface(
|
83 |
fn=predict,
|
84 |
inputs=[
|
85 |
+
gr.Image(label="Input Image", type="pil")
|
86 |
],
|
87 |
outputs=[
|
88 |
+
gr.Label(label="Class"),
|
89 |
+
gr.Image(label="Face with Explainability", type="pil")
|
90 |
],
|
91 |
).launch()
|