Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ from detectron2.engine import DefaultPredictor
|
|
20 |
from detectron2.config import get_cfg
|
21 |
from detectron2.utils.visualizer import Visualizer
|
22 |
from detectron2.data import MetadataCatalog
|
|
|
23 |
|
24 |
|
25 |
model_path = "https://huggingface.co/asalhi85/Smartathon-Detectron2/resolve/9f4d573340b033e651d4937906f23850f9b6bc57/phase2_detectron_model.pth"
|
@@ -56,19 +57,19 @@ def inference(image_url, image, min_score):
|
|
56 |
|
57 |
outputs = predictor(im)
|
58 |
|
59 |
-
v = Visualizer(im, my_metadata, scale=1.2)
|
60 |
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
|
61 |
|
62 |
return out.get_image()
|
63 |
|
64 |
|
65 |
-
title = "
|
66 |
-
description = "This demo introduces an interactive playground for our trained Detectron2 model.
|
67 |
-
article = '<p>Detectron model is available from our repository <a href="">here</a
|
68 |
|
69 |
gr.Interface(
|
70 |
inference,
|
71 |
-
[gr.inputs.Textbox(label="Image URL", placeholder="
|
72 |
gr.inputs.Image(type="numpy", label="Input Image"),
|
73 |
gr.Slider(minimum=0.0, maximum=1.0, value=0.5, label="Minimum score"),
|
74 |
],
|
|
|
20 |
from detectron2.config import get_cfg
|
21 |
from detectron2.utils.visualizer import Visualizer
|
22 |
from detectron2.data import MetadataCatalog
|
23 |
+
from detectron2.utils.visualizer import ColorMode
|
24 |
|
25 |
|
26 |
model_path = "https://huggingface.co/asalhi85/Smartathon-Detectron2/resolve/9f4d573340b033e651d4937906f23850f9b6bc57/phase2_detectron_model.pth"
|
|
|
57 |
|
58 |
outputs = predictor(im)
|
59 |
|
60 |
+
v = Visualizer(im, my_metadata, scale=1.2, instance_mode=ColorMode.IMAGE )
|
61 |
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
|
62 |
|
63 |
return out.get_image()
|
64 |
|
65 |
|
66 |
+
title = "Smarathon Phase2 Demo - Baseer"
|
67 |
+
description = "This demo introduces an interactive playground for our trained Detectron2 model."
|
68 |
+
article = '<p>Detectron model is available from our repository <a href="https://github.com/asalhi/Smartathon-Baseer">here</a>.</p>'
|
69 |
|
70 |
gr.Interface(
|
71 |
inference,
|
72 |
+
[gr.inputs.Textbox(label="Image URL", placeholder=""),
|
73 |
gr.inputs.Image(type="numpy", label="Input Image"),
|
74 |
gr.Slider(minimum=0.0, maximum=1.0, value=0.5, label="Minimum score"),
|
75 |
],
|