| 163 | |
| 164 | #send based on current situation |
| 165 | def send_request_in_chain(last_image_path,current_image_path,last_warped_path,mask,index,seed,fillindenoise,resolution): |
| 166 | |
| 167 | # with open(last_image_path, "rb") as f: |
| 168 | # last_image = base64.b64encode(f.read()).decode("utf-8") |
| 169 | # last_image = last_image_path |
| 170 | #with open(current_image_path, "rb") as b: |
| 171 | # current_image = base64.b64encode(b.read()).decode("utf-8") |
| 172 | current_image = current_image_path |
| 173 | |
| 174 | if not last_warped_path == "": |
| 175 | if os.path.isfile(last_warped_path): |
| 176 | with open(last_warped_path, "rb") as c: |
| 177 | last_warped = base64.b64encode(c.read()).decode("utf-8") |
| 178 | else: |
| 179 | last_warped = last_warped_path |
| 180 | else: |
| 181 | last_warped = current_image |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | data = { |
| 187 | "init_images": [last_warped], |
| 188 | "inpainting_fill": 1, |
| 189 | "inpaint_full_res": False, |
| 190 | "inpaint_full_res_padding": 1, |
| 191 | "inpainting_mask_invert": 0, |
| 192 | "resize_mode": 0, |
| 193 | "denoising_strength": fillindenoise, |
| 194 | "prompt":"", |
| 195 | "negative_prompt": "(ugly:1.3), (fused fingers), (too many fingers), (bad anatomy:1.5), (watermark:1.5), (words), letters, untracked eyes, asymmetric eyes, floating head, (logo:1.5), (bad hands:1.3), (mangled hands:1.2), (missing hands), (missing arms), backward hands, floating jewelry, unattached jewelry, floating head, doubled head, unattached head, doubled head, head in body, (misshapen body:1.1), (badly fitted headwear:1.2), floating arms, (too many arms:1.5), limbs fused with body, (facial blemish:1.5), badly fitted clothes, imperfect eyes, untracked eyes, crossed eyes, hair growing from clothes, partial faces, hair not attached to head", |
| 196 | "alwayson_scripts": { |
| 197 | "ControlNet":{ |
| 198 | "args": [ |
| 199 | { |
| 200 | "input_image": current_image, |
| 201 | "module": "hed", |
| 202 | "model": "control_hed-fp16 [13fee50b]", |
| 203 | "weight": 1, |
| 204 | "guidance": 1, |
| 205 | }, |
| 206 | { |
| 207 | "input_image": last_warped, |
| 208 | "model": "diff_control_sd15_temporalnet_fp16 [adc6bd97]", |
| 209 | "module": "none", |
| 210 | "weight": 1, |
| 211 | "guidance": 1, |
| 212 | } |
| 213 | |
| 214 | ] |
| 215 | } |
| 216 | }, |
| 217 | "seed": seed, |
| 218 | "subseed": -1, |
| 219 | "subseed_strength": -1, |
| 220 | "sampler_index": "Euler a", |
| 221 | "batch_size": 1, |
| 222 | "n_iter": 1, |