shekzee commited on
Commit
1f9611c
·
verified ·
1 Parent(s): 37cc80f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -31,7 +31,7 @@ async def predict(file: UploadFile = File(...)):
31
  logits = outputs.logits # (batch, num_labels, H, W)
32
  mask = torch.argmax(logits, dim=1)[0].numpy().astype(np.uint8)
33
 
34
- # Optionally, you can convert mask to RGB with a color map for visualization
35
  mask_img = Image.fromarray(mask)
36
  buf = BytesIO()
37
  mask_img.save(buf, format="PNG")
 
31
  logits = outputs.logits # (batch, num_labels, H, W)
32
  mask = torch.argmax(logits, dim=1)[0].numpy().astype(np.uint8)
33
 
34
+ # Convert mask to grayscale PNG and return as base64
35
  mask_img = Image.fromarray(mask)
36
  buf = BytesIO()
37
  mask_img.save(buf, format="PNG")