-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_infer.py
25 lines (18 loc) · 872 Bytes
/
run_infer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from inference import run_inference
input_img = 'input/royce.jpg'
run_inference(input_path=input_img,
model_path='original.pth',
output_dir='output/', # whether need intermediate results for animation.
need_animation=True, # resize original input to this size. None means do not resize.
resize_h=None, # resize original input to this size. None means do not resize.
resize_w=None,
serial=True) # if need animation, serial must be True.
# Create gif from individual steps
import glob
from PIL import Image
# Set to dir with output images
in_dir = 'output/royce/*.jpg'
out_path = 'output/royce.gif'
img, *imgs = [Image.open(f) for f in sorted(glob.glob(in_dir))]
img.save(fp=out_path, format='GIF', append_images=imgs,
save_all=True, duration=100, loop=0)