Spaces:
Sleeping
Sleeping
opening images using cv2
Browse files
app.py
CHANGED
@@ -14,10 +14,10 @@ from detectron2.utils.visualizer import Visualizer
|
|
14 |
from detectron2.data import MetadataCatalog
|
15 |
|
16 |
|
17 |
-
def predict(
|
18 |
print(datetime.datetime.now())
|
19 |
# Convert PIL Image to numpy array
|
20 |
-
input_image =
|
21 |
# Initialise model
|
22 |
cfg = get_cfg()
|
23 |
cfg.merge_from_file(model_zoo.get_config_file("COCO-PanopticSegmentation/panoptic_fpn_R_101_3x.yaml"))
|
@@ -42,5 +42,6 @@ image_input = gr.Image(type="pil", label="Input Image")
|
|
42 |
|
43 |
iface = gr.Interface(fn=predict,
|
44 |
inputs=[image_input],
|
45 |
-
outputs=gr.Image(type="pil")
|
|
|
46 |
iface.launch()
|
|
|
14 |
from detectron2.data import MetadataCatalog
|
15 |
|
16 |
|
17 |
+
def predict(image):
|
18 |
print(datetime.datetime.now())
|
19 |
# Convert PIL Image to numpy array
|
20 |
+
input_image = cv2.imread(image.name)
|
21 |
# Initialise model
|
22 |
cfg = get_cfg()
|
23 |
cfg.merge_from_file(model_zoo.get_config_file("COCO-PanopticSegmentation/panoptic_fpn_R_101_3x.yaml"))
|
|
|
42 |
|
43 |
iface = gr.Interface(fn=predict,
|
44 |
inputs=[image_input],
|
45 |
+
outputs=gr.Image(type="pil"),
|
46 |
+
examples=["examples/6178_3003_0.jpg"])
|
47 |
iface.launch()
|