Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,15 +6,13 @@ import numpy as np
|
|
6 |
|
7 |
extractor = AutoFeatureExtractor.from_pretrained("hshetty/segmentation-model-finetuned-on-semantic-sidewalk-3e-4-e5")
|
8 |
model = SegformerForSemanticSegmentation.from_pretrained("hshetty/segmentation-model-finetuned-on-semantic-sidewalk-3e-4-e5")
|
9 |
-
|
10 |
def classify(im):
|
11 |
inputs = extractor(images=im, return_tensors="pt")
|
12 |
outputs = model(**inputs)
|
13 |
logits = outputs.logits
|
14 |
classes = logits[0].detach().cpu().numpy().argmax(axis=0)
|
15 |
colors = np.array([[128,0,0], [128,128,0], [0, 0, 128], [128,0,128], [0, 0, 0]])
|
16 |
-
counter+=1
|
17 |
-
print("hshetty:{}".format(counter))
|
18 |
return colors[classes]
|
19 |
|
20 |
|
|
|
6 |
|
7 |
extractor = AutoFeatureExtractor.from_pretrained("hshetty/segmentation-model-finetuned-on-semantic-sidewalk-3e-4-e5")
|
8 |
model = SegformerForSemanticSegmentation.from_pretrained("hshetty/segmentation-model-finetuned-on-semantic-sidewalk-3e-4-e5")
|
9 |
+
|
10 |
def classify(im):
|
11 |
inputs = extractor(images=im, return_tensors="pt")
|
12 |
outputs = model(**inputs)
|
13 |
logits = outputs.logits
|
14 |
classes = logits[0].detach().cpu().numpy().argmax(axis=0)
|
15 |
colors = np.array([[128,0,0], [128,128,0], [0, 0, 128], [128,0,128], [0, 0, 0]])
|
|
|
|
|
16 |
return colors[classes]
|
17 |
|
18 |
|