radames commited on
Commit
dfc0c72
1 Parent(s): dfa4a23

fix and pin gradio version

Browse files
Files changed (2) hide show
  1. README.md +1 -0
  2. app.py +7 -6
README.md CHANGED
@@ -5,6 +5,7 @@ colorFrom: purple
5
  colorTo: purple
6
  sdk: gradio
7
  app_file: app.py
 
8
  pinned: false
9
  ---
10
 
 
5
  colorTo: purple
6
  sdk: gradio
7
  app_file: app.py
8
+ sdk_version: 3.17.1
9
  pinned: false
10
  ---
11
 
app.py CHANGED
@@ -482,8 +482,8 @@ def main(input_path, model_path, output_dir, need_animation=False, resize_h=None
482
  save_all=True, append_images=all_frames[1:], optimize=False, duration=40, loop=0)
483
  return os.path.join(frame_dir, "animation.gif"), tensor_to_pil
484
 
485
- def gradio_inference(image):
486
- return main(input_path=image.name,
487
  model_path='model.pth',
488
  output_dir='output/',
489
  need_animation=True, # whether need intermediate results for animation.
@@ -496,14 +496,15 @@ description = "Gradio demo for Paint Transformer: Feed Forward Neural Painting w
496
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.03798'>Paint Transformer: Feed Forward Neural Painting with Stroke Prediction</a> | <a href='https://github.com/Huage001/PaintTransformer'>Github Repo</a></p>"
497
  gr.Interface(
498
  gradio_inference,
499
- gr.inputs.Image(type="file", label="Input"),
500
- [gr.outputs.Image(type="file", label="Output GIF"),
501
- gr.outputs.Image(type="pil", label="Output Image")],
502
  title=title,
503
  description=description,
504
  article=article,
 
505
  examples=[
506
  ['city.jpg'],
507
  ['tower.jpg'],
508
  ]
509
- ).launch(enable_queue=True,cache_examples=True)
 
482
  save_all=True, append_images=all_frames[1:], optimize=False, duration=40, loop=0)
483
  return os.path.join(frame_dir, "animation.gif"), tensor_to_pil
484
 
485
+ def gradio_inference(image_path):
486
+ return main(input_path=image_path,
487
  model_path='model.pth',
488
  output_dir='output/',
489
  need_animation=True, # whether need intermediate results for animation.
 
496
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.03798'>Paint Transformer: Feed Forward Neural Painting with Stroke Prediction</a> | <a href='https://github.com/Huage001/PaintTransformer'>Github Repo</a></p>"
497
  gr.Interface(
498
  gradio_inference,
499
+ gr.Image(type="filepath", label="Input"),
500
+ [gr.Image(type="filepath", label="Output GIF"),
501
+ gr.Image(type="pil", label="Output Image")],
502
  title=title,
503
  description=description,
504
  article=article,
505
+ cache_examples=True,
506
  examples=[
507
  ['city.jpg'],
508
  ['tower.jpg'],
509
  ]
510
+ ).launch(enable_queue=True)