Omnibus commited on
Commit
6c656e8
1 Parent(s): 8a23d91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -146,22 +146,23 @@ def load_im(img):
146
  im = Image.open(img)
147
  width, height = im.size
148
  new_w=int(width/10)
149
- new_h=int(height/10)
150
-
151
-
152
-
153
- # Setting the points for cropped image
154
- left = 0
155
- top = 0
156
- right = new_w
157
- bottom = new_h
158
-
159
- # Cropped image of above dimension
160
- # (It will not change original image)
161
- im1 = im.crop((left, top, right, bottom))
162
- im_box.append(im1)
163
- return im_box
164
-
 
165
 
166
  with gr.Blocks(css=css) as app:
167
  with gr.Row():
@@ -175,7 +176,7 @@ with gr.Blocks(css=css) as app:
175
  model_drop=gr.Dropdown(label="Models", choices=models, type='index', value=models[0])
176
  cnt = gr.Number(value=1)
177
  out_html=gr.HTML()
178
- outp=gr.Gallery()
179
 
180
  im_btn.click(load_im,inp_im,outp)
181
  btn.click(run_dif,[inp,inp_im,model_drop,cnt],[outp,out_html])
 
146
  im = Image.open(img)
147
  width, height = im.size
148
  new_w=int(width/10)
149
+ new_h=new_w
150
+ for i in range(height):
151
+ for b in range(width):
152
+
153
+ # Setting the points for cropped image
154
+ left = b
155
+ top = i
156
+ right = left+new_w
157
+ bottom = top+new_h
158
+
159
+ # Cropped image of above dimension
160
+ # (It will not change original image)
161
+ im1 = im.crop((left, top, right, bottom))
162
+ im_box.append(im1)
163
+ b+=new_w
164
+ yield im_box
165
+ i+=new_h
166
 
167
  with gr.Blocks(css=css) as app:
168
  with gr.Row():
 
176
  model_drop=gr.Dropdown(label="Models", choices=models, type='index', value=models[0])
177
  cnt = gr.Number(value=1)
178
  out_html=gr.HTML()
179
+ outp=gr.Gallery(columns=10)
180
 
181
  im_btn.click(load_im,inp_im,outp)
182
  btn.click(run_dif,[inp,inp_im,model_drop,cnt],[outp,out_html])