Spaces:
Runtime error
Runtime error
Updated from colab
Browse files
app.py
CHANGED
@@ -8,10 +8,10 @@ extractor = AutoFeatureExtractor.from_pretrained("brendenc/my-segmentation-model
|
|
8 |
model = AutoModelForImageClassification.from_pretrained("brendenc/my-segmentation-model")
|
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().
|
15 |
colors = np.array([[128,0,0], [128,128,0], [0, 0, 128], [128,0,128], [0, 0, 0]])
|
16 |
return colors[classes]
|
17 |
|
|
|
8 |
model = AutoModelForImageClassification.from_pretrained("brendenc/my-segmentation-model")
|
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().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 |
|