Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -32,6 +32,8 @@ if not torch.cuda.is_available():
|
|
32 |
cfg.MODEL.DEVICE='cpu'
|
33 |
|
34 |
predictor = DefaultPredictor(cfg)
|
|
|
|
|
35 |
|
36 |
def inference(image):
|
37 |
print(image.height)
|
@@ -41,7 +43,7 @@ def inference(image):
|
|
41 |
img = np.array(image.resize((500, height)))
|
42 |
outputs = predictor(img)
|
43 |
v = Visualizer(img[:, :, ::-1],
|
44 |
-
|
45 |
scale=0.5,
|
46 |
instance_mode=ColorMode.SEGMENTATION # remove the colors of unsegmented pixels. This option is only available for segmentation models
|
47 |
)
|
|
|
32 |
cfg.MODEL.DEVICE='cpu'
|
33 |
|
34 |
predictor = DefaultPredictor(cfg)
|
35 |
+
my_metadata = MetadataCatalog.get("car_dataset_val")
|
36 |
+
my_metadata.thing_classes = ["damage"]
|
37 |
|
38 |
def inference(image):
|
39 |
print(image.height)
|
|
|
43 |
img = np.array(image.resize((500, height)))
|
44 |
outputs = predictor(img)
|
45 |
v = Visualizer(img[:, :, ::-1],
|
46 |
+
metadata=my_metadata,
|
47 |
scale=0.5,
|
48 |
instance_mode=ColorMode.SEGMENTATION # remove the colors of unsegmented pixels. This option is only available for segmentation models
|
49 |
)
|