@@ -145,11 +145,16 @@ def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_wind
145145
146146 stream .output_queue .push (('progress' , (None , '' , make_progress_bar_html (0 , 'Image processing ...' ))))
147147
148- H , W , C = input_image .shape
149- height , width = find_nearest_bucket (H , W , resolution = 640 )
150- input_image_np = resize_and_center_crop (input_image , target_width = width , target_height = height )
151148
152- Image .fromarray (input_image_np ).save (os .path .join (outputs_folder , f'{ job_id } .png' ))
149+ if input_image is None :
150+ input_image = np .zeros ((resolution , resolution , 3 ), dtype = np .uint8 )
151+ height = width = resolution
152+ input_image_np = np .array (input_image )
153+ else :
154+ H , W , C = input_image .shape
155+ height , width = find_nearest_bucket (H , W , resolution = resolution )
156+ input_image_np = resize_and_center_crop (input_image , target_width = width , target_height = height )
157+ Image .fromarray (input_image_np ).save (os .path .join (outputs_folder , f'{ job_id } .png' ))
153158
154159 input_image_pt = torch .from_numpy (input_image_np ).float () / 127.5 - 1
155160 input_image_pt = input_image_pt .permute (2 , 0 , 1 )[None , :, None ]
@@ -325,7 +330,6 @@ def callback(d):
325330
326331def process (input_image , prompt , n_prompt , seed , total_second_length , latent_window_size , steps , cfg , gs , rs , gpu_memory_preservation , use_teacache , mp4_crf ):
327332 global stream
328- assert input_image is not None , 'No input image!'
329333
330334 yield None , None , '' , '' , gr .update (interactive = False ), gr .update (interactive = True )
331335
0 commit comments