Spaces:
Runtime error
Runtime error
Commit
·
6f4a3d8
1
Parent(s):
828ccaf
Update app.py
Browse files
app.py
CHANGED
@@ -27,11 +27,11 @@ import numpy as np
|
|
27 |
model_path = "model_final.pth"
|
28 |
|
29 |
cfg = get_cfg()
|
30 |
-
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.
|
31 |
-
cfg.MODEL.ROI_HEADS.NUM_CLASSES =
|
32 |
cfg.MODEL.WEIGHTS = model_path
|
33 |
st.write("""
|
34 |
-
#
|
35 |
"""
|
36 |
)
|
37 |
file = st.file_uploader("Please upload an image file(JPG/PNG/JPEG format)", type=["jpg", "png","jpeg"])
|
@@ -39,7 +39,7 @@ file = st.file_uploader("Please upload an image file(JPG/PNG/JPEG format)", type
|
|
39 |
st.set_option('deprecation.showfileUploaderEncoding', False)
|
40 |
|
41 |
car_metadata = MetadataCatalog.get("test1")
|
42 |
-
car_metadata.thing_classes = ['
|
43 |
|
44 |
if not torch.cuda.is_available():
|
45 |
cfg.MODEL.DEVICE='cpu'
|
|
|
27 |
model_path = "model_final.pth"
|
28 |
|
29 |
cfg = get_cfg()
|
30 |
+
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.7
|
31 |
+
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 2
|
32 |
cfg.MODEL.WEIGHTS = model_path
|
33 |
st.write("""
|
34 |
+
# Gun Detection
|
35 |
"""
|
36 |
)
|
37 |
file = st.file_uploader("Please upload an image file(JPG/PNG/JPEG format)", type=["jpg", "png","jpeg"])
|
|
|
39 |
st.set_option('deprecation.showfileUploaderEncoding', False)
|
40 |
|
41 |
car_metadata = MetadataCatalog.get("test1")
|
42 |
+
car_metadata.thing_classes = ['guns','Gun',]
|
43 |
|
44 |
if not torch.cuda.is_available():
|
45 |
cfg.MODEL.DEVICE='cpu'
|