fradinho commited on
Commit
edc61ac
·
1 Parent(s): 9ab01e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -87,7 +87,16 @@ def predict_2(image):
87
  from empatches import EMPatches
88
 
89
  def predict_patches(image):
90
- #img = Image.open(image)
 
 
 
 
 
 
 
 
 
91
  image = Image.fromarray(image).resize((size,size))
92
  image = np.array(image)/255
93
  emp = EMPatches()
 
87
  from empatches import EMPatches
88
 
89
  def predict_patches(image):
90
+ size = 1024
91
+ sizes_list = [256*10, 256*9, 256*8, 256*7, 256*6, 256*5, 256*4, 256*3, 256*2, 256*1]
92
+ min_size = min(image.shape)
93
+ if min_size%256==0:
94
+ size = min_size
95
+ else:
96
+ for i in sizes_list:
97
+ if min_size-i >= 0:
98
+ size = i
99
+ break
100
  image = Image.fromarray(image).resize((size,size))
101
  image = np.array(image)/255
102
  emp = EMPatches()