cmahima commited on
Commit
48b0c32
1 Parent(s): 3caa2ca

change app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -288,7 +288,7 @@ with image_blocks as demo:
288
  )
289
 
290
  with gr.Column():
291
- garm_img = gr.Image(label="Garment", sources='upload', type="pil")
292
  with gr.Row(elem_id="prompt-container"):
293
  with gr.Row():
294
  prompt = gr.Textbox(placeholder="Description of garment ex) Yellow Top", show_label=False, elem_id="prompt")
@@ -315,8 +315,13 @@ with image_blocks as demo:
315
 
316
 
317
  fetch_button.click(fn=fetch_products, inputs=prompt, outputs=[image_gallery, price_display, url_display])
 
 
 
 
 
318
 
319
- try_button.click(fn=start_tryon, inputs=[imgs, image_gallery, prompt, is_checked,is_checked_crop, denoise_steps, seed], outputs=[image_out,masked_img], api_name='tryon')
320
 
321
 
322
 
 
288
  )
289
 
290
  with gr.Column():
291
+ garm_img = gr.Image(label="Garment", elem_id="amazon-img",show_share_button=False)
292
  with gr.Row(elem_id="prompt-container"):
293
  with gr.Row():
294
  prompt = gr.Textbox(placeholder="Description of garment ex) Yellow Top", show_label=False, elem_id="prompt")
 
315
 
316
 
317
  fetch_button.click(fn=fetch_products, inputs=prompt, outputs=[image_gallery, price_display, url_display])
318
+ def select_image(index, gallery_images):
319
+ if index is not None and index < len(gallery_images):
320
+ return gallery_images[index]
321
+ return None
322
+ image_gallery.select(fn=select_image, inputs=[gr.inputs.Slider(0, len(image_gallery) - 1), image_gallery], outputs=garm_img)
323
 
324
+ try_button.click(fn=start_tryon, inputs=[imgs, garm_img, prompt, is_checked,is_checked_crop, denoise_steps, seed], outputs=[image_out,masked_img], api_name='tryon')
325
 
326
 
327