Update handler.py
Browse files- handler.py +2 -5
handler.py
CHANGED
|
@@ -9,12 +9,9 @@ import diffusers
|
|
| 9 |
from diffusers.utils import load_image
|
| 10 |
from diffusers.models import ControlNetModel
|
| 11 |
from diffusers.pipelines.controlnet.multicontrolnet import MultiControlNetModel
|
| 12 |
-
from insightface.app import FaceAnalysis
|
| 13 |
from style_template import styles
|
| 14 |
from pipeline_stable_diffusion_xl_instantid_full import StableDiffusionXLInstantIDPipeline, draw_kps
|
| 15 |
from controlnet_aux import OpenposeDetector
|
| 16 |
-
import torch.nn.functional as F
|
| 17 |
-
from torchvision.transforms import Compose
|
| 18 |
import os
|
| 19 |
from huggingface_hub import hf_hub_download
|
| 20 |
import base64
|
|
@@ -240,7 +237,7 @@ class EndpointHandler:
|
|
| 240 |
|
| 241 |
pose_image_base64 = data.get("pose_image_base64")
|
| 242 |
pose_image = None
|
| 243 |
-
if
|
| 244 |
pose_image_data = base64.b64decode(pose_image_base64)
|
| 245 |
pose_image = Image.open(io.BytesIO(pose_image_data))
|
| 246 |
|
|
@@ -300,7 +297,7 @@ class EndpointHandler:
|
|
| 300 |
outputs = self.pipe(
|
| 301 |
prompt=inputs,
|
| 302 |
negative_prompt=negative_prompt,
|
| 303 |
-
image_embeds=
|
| 304 |
image=control_images,
|
| 305 |
control_mask=control_mask,
|
| 306 |
controlnet_conditioning_scale=control_scales,
|
|
|
|
| 9 |
from diffusers.utils import load_image
|
| 10 |
from diffusers.models import ControlNetModel
|
| 11 |
from diffusers.pipelines.controlnet.multicontrolnet import MultiControlNetModel
|
|
|
|
| 12 |
from style_template import styles
|
| 13 |
from pipeline_stable_diffusion_xl_instantid_full import StableDiffusionXLInstantIDPipeline, draw_kps
|
| 14 |
from controlnet_aux import OpenposeDetector
|
|
|
|
|
|
|
| 15 |
import os
|
| 16 |
from huggingface_hub import hf_hub_download
|
| 17 |
import base64
|
|
|
|
| 237 |
|
| 238 |
pose_image_base64 = data.get("pose_image_base64")
|
| 239 |
pose_image = None
|
| 240 |
+
if pose_image_base64:
|
| 241 |
pose_image_data = base64.b64decode(pose_image_base64)
|
| 242 |
pose_image = Image.open(io.BytesIO(pose_image_data))
|
| 243 |
|
|
|
|
| 297 |
outputs = self.pipe(
|
| 298 |
prompt=inputs,
|
| 299 |
negative_prompt=negative_prompt,
|
| 300 |
+
image_embeds=None, # Removed face_emb
|
| 301 |
image=control_images,
|
| 302 |
control_mask=control_mask,
|
| 303 |
controlnet_conditioning_scale=control_scales,
|