WeShop commited on
Commit
4276ea3
·
1 Parent(s): 35439ab

image format

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -190,7 +190,7 @@ def upload_image(image, upload_type, did, ip, user_id, user_name):
190
  upload_url = upload_image_url
191
  else:
192
  upload_url = upload_background_image_url
193
- image_format = image.format if image.format else "PNG"
194
  mime_type = f"image/{image_format.lower()}"
195
  timestamp = str(int(time.time()))
196
  signature = generate_signature(
@@ -395,6 +395,7 @@ with gr.Blocks(css=css) as WeShop:
395
  gr.Markdown("#### Step 1: Upload a garment image")
396
  main_image_input = gr.Image(
397
  type="pil",
 
398
  label="Main Image",
399
  elem_classes=["image-container", "hide-buttons"]
400
  )
@@ -410,6 +411,7 @@ with gr.Blocks(css=css) as WeShop:
410
  gr.Markdown("#### Step 2: Upload a person image")
411
  background_image_input = gr.Image(
412
  type="pil",
 
413
  label="Background reference image",
414
  elem_classes=["image-container", "hide-buttons"]
415
  )
@@ -426,6 +428,7 @@ with gr.Blocks(css=css) as WeShop:
426
  gr.Markdown("#### Step 3: Press 'Generate' to get the result")
427
  output = gr.Image(
428
  type="pil",
 
429
  label="Result",
430
  elem_classes=["image-container", "hide-buttons"],
431
  interactive=False
@@ -453,14 +456,4 @@ with gr.Blocks(css=css) as WeShop:
453
  inputs=[main_image_input, background_image_input, output],
454
  elem_id="example-res-images",
455
  )
456
- main_image_input.upload(
457
- fn=preprocess_image,
458
- inputs=[main_image_input],
459
- outputs=main_image_input
460
- )
461
- background_image_input.upload(
462
- fn=preprocess_background_image,
463
- inputs=[background_image_input],
464
- outputs=background_image_input
465
- )
466
  WeShop.queue(api_open=False).launch(show_api=False)
 
190
  upload_url = upload_image_url
191
  else:
192
  upload_url = upload_background_image_url
193
+ image_format = "PNG"
194
  mime_type = f"image/{image_format.lower()}"
195
  timestamp = str(int(time.time()))
196
  signature = generate_signature(
 
395
  gr.Markdown("#### Step 1: Upload a garment image")
396
  main_image_input = gr.Image(
397
  type="pil",
398
+ format='png',
399
  label="Main Image",
400
  elem_classes=["image-container", "hide-buttons"]
401
  )
 
411
  gr.Markdown("#### Step 2: Upload a person image")
412
  background_image_input = gr.Image(
413
  type="pil",
414
+ format='png',
415
  label="Background reference image",
416
  elem_classes=["image-container", "hide-buttons"]
417
  )
 
428
  gr.Markdown("#### Step 3: Press 'Generate' to get the result")
429
  output = gr.Image(
430
  type="pil",
431
+ format='png',
432
  label="Result",
433
  elem_classes=["image-container", "hide-buttons"],
434
  interactive=False
 
456
  inputs=[main_image_input, background_image_input, output],
457
  elem_id="example-res-images",
458
  )
 
 
 
 
 
 
 
 
 
 
459
  WeShop.queue(api_open=False).launch(show_api=False)