3
3
from PIL import Image , ImageOps
4
4
import requests
5
5
import numpy as np
6
+ from math import ceil
6
7
import torchvision .transforms .functional as TF
7
8
from pytorch_lightning import seed_everything
8
9
import os
23
24
import cv2
24
25
from .animation import sample_from_cv2 , sample_to_cv2
25
26
from modules import processing , masking
27
+ import modules .shared as shared
26
28
from modules .shared import opts , sd_model
27
29
from modules .processing import process_images , StableDiffusionProcessingTxt2Img
28
30
@@ -185,6 +187,8 @@ def generate(args, root, frame = 0, return_sample=False):
185
187
#color correction for zeroes inpainting
186
188
p .color_corrections = [processing .setup_color_correction (init_image )]
187
189
190
+ print ("Inpainting zeros" )
191
+
188
192
processed = processing .process_images (p )
189
193
190
194
init_image = processed .images [0 ].convert ('RGB' )
@@ -193,6 +197,13 @@ def generate(args, root, frame = 0, return_sample=False):
193
197
p .image_mask = None
194
198
mask_image = None
195
199
processed = None
200
+ else :
201
+ # fix tqdm total steps if we don't have to conduct a second pass
202
+ tqdm_instance = shared .total_tqdm
203
+ current_total = tqdm_instance .getTotal ()
204
+ if current_total != - 1 :
205
+ tqdm_instance .updateTotal (current_total - int (ceil (args .steps * (1 - args .strength ))))
206
+
196
207
197
208
elif args .use_init and args .init_image != None and args .init_image != '' :
198
209
init_image , mask_image = load_img (args .init_image ,
0 commit comments