Adhikary, Dhruba
commited on
Commit
•
592721a
1
Parent(s):
bd98368
push changes to hugging face
Browse files- __pycache__/config.cpython-310.pyc +0 -0
- __pycache__/model.cpython-310.pyc +0 -0
- __pycache__/utils.cpython-310.pyc +0 -0
- app.py +4 -2
__pycache__/config.cpython-310.pyc
ADDED
Binary file (3 kB). View file
|
|
__pycache__/model.cpython-310.pyc
ADDED
Binary file (4.46 kB). View file
|
|
__pycache__/utils.cpython-310.pyc
ADDED
Binary file (6.67 kB). View file
|
|
app.py
CHANGED
@@ -14,9 +14,11 @@ import os
|
|
14 |
import matplotlib.pyplot as plt
|
15 |
from utils import *
|
16 |
|
|
|
|
|
17 |
|
18 |
model = YOLOv3(num_classes=config.NUM_CLASSES).to(config.DEVICE)
|
19 |
-
model.load_state_dict(torch.load(
|
20 |
|
21 |
IMAGE_SIZE = config.IMAGE_SIZE
|
22 |
test_transforms = A.Compose(
|
@@ -78,7 +80,7 @@ demo = gr.Interface(
|
|
78 |
gr.Slider(0, 1, value = 0.75, label="Threshold"),
|
79 |
gr.Slider(0, 1, value = 0.75, label="IoU Threshold"),
|
80 |
gr.Slider(0, 1, value = 0.8, label="Opacity of GradCAM")],
|
81 |
-
outputs = [gr.Image(
|
82 |
title = title,
|
83 |
description = description,
|
84 |
examples = examples,
|
|
|
14 |
import matplotlib.pyplot as plt
|
15 |
from utils import *
|
16 |
|
17 |
+
checkpoint_filename = "object_detection_app/custom_yolo_v3.pt"
|
18 |
+
relative_path = os.path.join(os.getcwd(),"hugging_space_app", checkpoint_filename)
|
19 |
|
20 |
model = YOLOv3(num_classes=config.NUM_CLASSES).to(config.DEVICE)
|
21 |
+
model.load_state_dict(torch.load(relative_path, map_location=torch.device('cpu')), strict=False)
|
22 |
|
23 |
IMAGE_SIZE = config.IMAGE_SIZE
|
24 |
test_transforms = A.Compose(
|
|
|
80 |
gr.Slider(0, 1, value = 0.75, label="Threshold"),
|
81 |
gr.Slider(0, 1, value = 0.75, label="IoU Threshold"),
|
82 |
gr.Slider(0, 1, value = 0.8, label="Opacity of GradCAM")],
|
83 |
+
outputs = [gr.Image(width=600, height=600,label="Output")],
|
84 |
title = title,
|
85 |
description = description,
|
86 |
examples = examples,
|