Ahsen Khaliq commited on
Commit
ea4050e
1 Parent(s): 16924a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -510,7 +510,7 @@ def main(input_path, model_path, output_dir, need_animation=False, resize_h=None
510
 
511
  all_frames[0].save(os.path.join(frame_dir, 'animation.gif'),
512
  save_all=True, append_images=all_frames[1:], optimize=False, duration=40, loop=0)
513
- return os.path.join(frame_dir, "animation.gif")
514
 
515
 
516
  def gradio_inference(image):
@@ -518,8 +518,8 @@ def gradio_inference(image):
518
  model_path='model.pth',
519
  output_dir='output/',
520
  need_animation=True, # whether need intermediate results for animation.
521
- resize_h=400, # resize original input to this size. None means do not resize.
522
- resize_w=400, # resize original input to this size. None means do not resize.
523
  serial=True) # if need animation, serial must be True.
524
 
525
  title = "Paint Transformer"
@@ -528,8 +528,9 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.037
528
 
529
  gr.Interface(
530
  gradio_inference,
531
- [gr.inputs.Image(type="file", label="Input")],
532
- gr.outputs.Image(type="file", label="Output"),
 
533
  title=title,
534
  description=description,
535
  article=article,
 
510
 
511
  all_frames[0].save(os.path.join(frame_dir, 'animation.gif'),
512
  save_all=True, append_images=all_frames[1:], optimize=False, duration=40, loop=0)
513
+ return os.path.join(frame_dir, "animation.gif"), tensor_to_pil
514
 
515
 
516
  def gradio_inference(image):
 
518
  model_path='model.pth',
519
  output_dir='output/',
520
  need_animation=True, # whether need intermediate results for animation.
521
+ resize_h=300, # resize original input to this size. None means do not resize.
522
+ resize_w=300, # resize original input to this size. None means do not resize.
523
  serial=True) # if need animation, serial must be True.
524
 
525
  title = "Paint Transformer"
 
528
 
529
  gr.Interface(
530
  gradio_inference,
531
+ gr.inputs.Image(type="file", label="Input"),
532
+ [gr.outputs.Image(type="file", label="Output GIF"),
533
+ gr.outputs.Image(type="pil", label="Output Image")],
534
  title=title,
535
  description=description,
536
  article=article,