sigyllly commited on
Commit
945cca9
1 Parent(s): 5baf5ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -25,10 +25,6 @@ def process_image(image, prompt, threshold, alpha_value, draw_rectangles):
25
 
26
  pred = torch.sigmoid(preds)
27
  mat = pred.cpu().numpy()
28
-
29
- # Squeeze to remove dimensions of size 1 (batch and channel dimensions)
30
- mat = np.squeeze(mat, axis=(0, 1)) # Convert from [1, 1, H, W] to [H, W]
31
-
32
  mask = Image.fromarray(np.uint8(mat * 255), "L")
33
  mask = mask.convert("RGB")
34
  mask = mask.resize(image.size)
@@ -103,6 +99,6 @@ def mask_image_api():
103
  _, result_mask, result_output = process_image(image, prompt, threshold, alpha_value, draw_rectangles)
104
 
105
  return jsonify({'result_mask': result_mask, 'result_output': result_output})
106
-
107
  if __name__ == '__main__':
108
  app.run(host='0.0.0.0', port=7860, debug=True)
 
25
 
26
  pred = torch.sigmoid(preds)
27
  mat = pred.cpu().numpy()
 
 
 
 
28
  mask = Image.fromarray(np.uint8(mat * 255), "L")
29
  mask = mask.convert("RGB")
30
  mask = mask.resize(image.size)
 
99
  _, result_mask, result_output = process_image(image, prompt, threshold, alpha_value, draw_rectangles)
100
 
101
  return jsonify({'result_mask': result_mask, 'result_output': result_output})
102
+
103
  if __name__ == '__main__':
104
  app.run(host='0.0.0.0', port=7860, debug=True)