brendenc commited on
Commit
945aef0
1 Parent(s): e929201

Updated from colab

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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").to("cuda")
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
 
 
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