hamzaanwar12 commited on
Commit
c0e973f
·
1 Parent(s): 684dd8e

IMage ot be downlaoded

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -341,8 +341,17 @@ def pose_transfer(source_image, test_pair_index):
341
  sampling_imgs = sampling_imgs.clamp(0, 1)
342
 
343
  # Convert to PIL image
344
- output_img = Image.fromarray((sampling_imgs[0] * 255.).permute((1, 2, 0)).long().cpu().numpy().astype(np.uint8)).resize((256, 256))
345
-
 
 
 
 
 
 
 
 
 
346
  return output_img
347
 
348
  def start_download():
@@ -440,7 +449,14 @@ with gr.Blocks() as demo:
440
  generate_btn = gr.Button("🚀 Generate Pose Transfer")
441
 
442
  with gr.Column():
443
- output_image = gr.Image(label="Output Image")
 
 
 
 
 
 
 
444
  status_message = gr.Textbox(label="Status", interactive=False)
445
 
446
  generate_btn.click(
 
341
  sampling_imgs = sampling_imgs.clamp(0, 1)
342
 
343
  # Convert to PIL image
344
+ # output_img = Image.fromarray((sampling_imgs[0] * 255.).permute((1, 2, 0)).long().cpu().numpy().astype(np.uint8)).resize((256, 256))
345
+ # Convert tensor to PIL image without resizing
346
+ output_img = Image.fromarray(
347
+ (sampling_imgs[0] * 255.)
348
+ .permute((1, 2, 0))
349
+ .long()
350
+ .cpu()
351
+ .numpy()
352
+ .astype(np.uint8)
353
+ )
354
+
355
  return output_img
356
 
357
  def start_download():
 
449
  generate_btn = gr.Button("🚀 Generate Pose Transfer")
450
 
451
  with gr.Column():
452
+ # output_image = gr.Image(label="Output Image")
453
+ output_image = gr.Image(
454
+ label="Output Image",
455
+ type="pil", # ✅ Must be 'pil'
456
+ format="png", # ✅ Force PNG encoding
457
+ show_download_button=True # ✅ Enables download
458
+ )
459
+
460
  status_message = gr.Textbox(label="Status", interactive=False)
461
 
462
  generate_btn.click(