afdx2 commited on
Commit
c87d020
·
verified ·
1 Parent(s): 2689e8f

Update server1.py

Browse files
Files changed (1) hide show
  1. server1.py +8 -3
server1.py CHANGED
@@ -38,8 +38,14 @@ def detect_blocks(image_bytes):
38
 
39
  for mask in masks:
40
 
41
- # ***** ARREGLO AQUI *****
42
- mask = np.squeeze(mask) # <-- MUY IMPORTANTE
 
 
 
 
 
 
43
 
44
  ys, xs = np.where(mask > 0.5)
45
  if len(xs) == 0:
@@ -53,7 +59,6 @@ def detect_blocks(image_bytes):
53
  return blocks
54
 
55
 
56
-
57
  @app.post("/strip/")
58
  async def strip(front: UploadFile = File(...)):
59
  try:
 
38
 
39
  for mask in masks:
40
 
41
+ mask = np.array(mask)
42
+
43
+ # forzar a 2D
44
+ while mask.ndim > 2:
45
+ mask = mask[0]
46
+
47
+ if mask.ndim != 2:
48
+ continue
49
 
50
  ys, xs = np.where(mask > 0.5)
51
  if len(xs) == 0:
 
59
  return blocks
60
 
61
 
 
62
  @app.post("/strip/")
63
  async def strip(front: UploadFile = File(...)):
64
  try: