Spaces:
Sleeping
Sleeping
Commit ·
14ca826
1
Parent(s): 45b0c78
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,7 @@ import torch
|
|
| 33 |
import cv2
|
| 34 |
import numpy as np
|
| 35 |
import gradio as gr
|
|
|
|
| 36 |
|
| 37 |
model = YOLOv3Lightning()
|
| 38 |
model.load_state_dict(torch.load("yolov3_model_without_75_mosaic.pth", map_location=torch.device('cpu')), strict=False)
|
|
@@ -88,13 +89,12 @@ def process_image_and_plot(image, model, scaled_anchors):
|
|
| 88 |
|
| 89 |
return fig,cam_image
|
| 90 |
|
|
|
|
| 91 |
|
| 92 |
-
examples = [
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
["images/human.jpg"],
|
| 97 |
-
]
|
| 98 |
|
| 99 |
def processed_image(image):
|
| 100 |
figure,gradcam = process_image_and_plot(image, model, scaled_anchors)
|
|
|
|
| 33 |
import cv2
|
| 34 |
import numpy as np
|
| 35 |
import gradio as gr
|
| 36 |
+
import os
|
| 37 |
|
| 38 |
model = YOLOv3Lightning()
|
| 39 |
model.load_state_dict(torch.load("yolov3_model_without_75_mosaic.pth", map_location=torch.device('cpu')), strict=False)
|
|
|
|
| 89 |
|
| 90 |
return fig,cam_image
|
| 91 |
|
| 92 |
+
images_folder = "examples"
|
| 93 |
|
| 94 |
+
examples = [[os.path.join(images_folder,"automobile.jpg")],
|
| 95 |
+
[os.path.join(images_folder,"cycle.jpg")],
|
| 96 |
+
[os.path.join(images_folder,"dog-kitten.jpg")],
|
| 97 |
+
[os.path.join(images_folder,"human.jpg")]]
|
|
|
|
|
|
|
| 98 |
|
| 99 |
def processed_image(image):
|
| 100 |
figure,gradcam = process_image_and_plot(image, model, scaled_anchors)
|