@@ -35,7 +35,7 @@ class Config:
3535def outpaint_inf (
3636 prompt : str ,
3737 negative_prompt : str ,
38- init_image : str ,
38+ init_image : Image ,
3939 pixels : int ,
4040 mask_blur : int ,
4141 directions : list ,
@@ -66,7 +66,7 @@ def outpaint_inf(
6666 args .guidance_scale = guidance_scale
6767 args .steps = steps
6868 args .scheduler = scheduler
69- args .img_path = init_image
69+ args .img_path = "not none"
7070
7171 # set ckpt_loc and hf_model_id.
7272 types = (
@@ -143,7 +143,6 @@ def outpaint_inf(
143143 generated_imgs = []
144144 seeds = []
145145 img_seed = utils .sanitize_seed (seed )
146- image = Image .open (args .img_path )
147146
148147 left = True if "left" in directions else False
149148 right = True if "right" in directions else False
@@ -156,7 +155,7 @@ def outpaint_inf(
156155 out_imgs = outpaint_obj .generate_images (
157156 prompt ,
158157 negative_prompt ,
159- image ,
158+ init_image ,
160159 pixels ,
161160 mask_blur ,
162161 left ,
@@ -271,5 +270,22 @@ def outpaint_inf(
271270 text_output += outpaint_obj .log
272271 text_output += f"\n Total image generation time: { total_time :.4f} sec"
273272
274- save_output_img (generated_imgs [0 ], seed )
273+ # save this information as metadata of output generated image.
274+ directions = []
275+ if args .left :
276+ directions .append ("left" )
277+ if args .right :
278+ directions .append ("right" )
279+ if args .top :
280+ directions .append ("up" )
281+ if args .bottom :
282+ directions .append ("down" )
283+ extra_info = {
284+ "PIXELS" : args .pixels ,
285+ "MASK_BLUR" : args .mask_blur ,
286+ "DIRECTIONS" : directions ,
287+ "NOISE_Q" : args .noise_q ,
288+ "COLOR_VARIATION" : args .color_variation ,
289+ }
290+ save_output_img (generated_imgs [0 ], seed , extra_info )
275291 print (text_output )
0 commit comments