xinjie.wang commited on
Commit
e39cf22
·
1 Parent(s): 4811e40
Files changed (1) hide show
  1. app.py +24 -16
app.py CHANGED
@@ -189,9 +189,9 @@ with gr.Blocks(
189
  )
190
  ],
191
  inputs=[image_prompt],
192
- fn=preprocess_image_fn,
193
- outputs=[image_prompt],
194
- run_on_click=True,
195
  examples_per_page=10,
196
  )
197
 
@@ -205,9 +205,9 @@ with gr.Blocks(
205
  )
206
  ],
207
  inputs=[image_prompt_sam],
208
- fn=preprocess_sam_image_fn,
209
- outputs=[image_prompt_sam],
210
- run_on_click=True,
211
  examples_per_page=10,
212
  )
213
  with gr.Column(scale=1):
@@ -252,11 +252,11 @@ with gr.Blocks(
252
  outputs=[is_samimage, single_sam_image_example, single_image_example],
253
  )
254
 
255
- image_prompt.upload(
256
- preprocess_image_fn,
257
- inputs=[image_prompt],
258
- outputs=[image_prompt],
259
- )
260
  image_prompt.change(
261
  lambda: tuple(
262
  [
@@ -294,6 +294,10 @@ with gr.Blocks(
294
  est_mass_text,
295
  est_mu_text,
296
  ],
 
 
 
 
297
  )
298
  image_prompt.change(
299
  active_btn_by_content,
@@ -301,11 +305,11 @@ with gr.Blocks(
301
  outputs=generate_btn,
302
  )
303
 
304
- image_prompt_sam.upload(
305
- preprocess_sam_image_fn,
306
- inputs=[image_prompt_sam],
307
- outputs=[image_prompt_sam],
308
- )
309
  image_prompt_sam.change(
310
  lambda: tuple(
311
  [
@@ -345,6 +349,10 @@ with gr.Blocks(
345
  image_mask_sam,
346
  selected_points,
347
  ],
 
 
 
 
348
  )
349
 
350
  image_prompt_sam.select(
 
189
  )
190
  ],
191
  inputs=[image_prompt],
192
+ # fn=preprocess_image_fn,
193
+ # outputs=[image_prompt],
194
+ # run_on_click=True,
195
  examples_per_page=10,
196
  )
197
 
 
205
  )
206
  ],
207
  inputs=[image_prompt_sam],
208
+ # fn=preprocess_sam_image_fn,
209
+ # outputs=[image_prompt_sam],
210
+ # run_on_click=True,
211
  examples_per_page=10,
212
  )
213
  with gr.Column(scale=1):
 
252
  outputs=[is_samimage, single_sam_image_example, single_image_example],
253
  )
254
 
255
+ # image_prompt.upload(
256
+ # preprocess_image_fn,
257
+ # inputs=[image_prompt],
258
+ # outputs=[image_prompt],
259
+ # )
260
  image_prompt.change(
261
  lambda: tuple(
262
  [
 
294
  est_mass_text,
295
  est_mu_text,
296
  ],
297
+ ).success(
298
+ preprocess_image_fn,
299
+ inputs=[image_prompt],
300
+ outputs=[image_prompt],
301
  )
302
  image_prompt.change(
303
  active_btn_by_content,
 
305
  outputs=generate_btn,
306
  )
307
 
308
+ # image_prompt_sam.upload(
309
+ # preprocess_sam_image_fn,
310
+ # inputs=[image_prompt_sam],
311
+ # outputs=[image_prompt_sam],
312
+ # )
313
  image_prompt_sam.change(
314
  lambda: tuple(
315
  [
 
349
  image_mask_sam,
350
  selected_points,
351
  ],
352
+ ).success(
353
+ preprocess_sam_image_fn,
354
+ inputs=[image_prompt_sam],
355
+ outputs=[image_prompt_sam],
356
  )
357
 
358
  image_prompt_sam.select(