Astridkraft commited on
Commit
2562888
·
verified ·
1 Parent(s): 7a34179

Update controlnet_facefix.py

Browse files
Files changed (1) hide show
  1. controlnet_facefix.py +5 -7
controlnet_facefix.py CHANGED
@@ -1,6 +1,6 @@
1
  # controlnet_facefix.py - EINFACHE VERSION (GANZES BILD VERBESSERN)
2
  import torch
3
- from diffusers import StableDiffusionControlNetInpaintPipeline, ControlNetModel
4
  from PIL import Image
5
  import time
6
  import cv2
@@ -97,7 +97,7 @@ def apply_facefix(image: Image.Image, prompt: str, negative_prompt: str, seed: i
97
  if _pipeline is None:
98
  try:
99
  print("🔄 Lade Face-Fix Pipeline...")
100
- _pipeline = StableDiffusionControlNetInpaintPipeline.from_pretrained(
101
  model_id,
102
  controlnet=[_controlnet_pose, _controlnet_depth],
103
  torch_dtype=torch.float16,
@@ -130,17 +130,15 @@ def apply_facefix(image: Image.Image, prompt: str, negative_prompt: str, seed: i
130
  result = pipeline(
131
  prompt=enhanced_prompt,
132
  negative_prompt=enhanced_negative,
133
- image=image.resize((512, 512)),
134
- mask_image=None, # ← WICHTIG: None = ganzes Bild!
135
- control_image=[pose_img, depth_img],
136
- controlnet_conditioning_scale=[0.7, 0.5], # Mittel für subtile Verbesserung
137
- strength=0.3, # Niedrig für feine Anpassungen
138
  num_inference_steps=20,
139
  guidance_scale=7.0,
140
  generator=torch.Generator(device).manual_seed(seed),
141
  height=512,
142
  width=512,
143
  ).images[0]
 
144
 
145
  # Zurück auf Originalgröße
146
  if image.size != (512, 512):
 
1
  # controlnet_facefix.py - EINFACHE VERSION (GANZES BILD VERBESSERN)
2
  import torch
3
+ from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
4
  from PIL import Image
5
  import time
6
  import cv2
 
97
  if _pipeline is None:
98
  try:
99
  print("🔄 Lade Face-Fix Pipeline...")
100
+ _pipeline = StableDiffusionControlNetPipeline.from_pretrained(
101
  model_id,
102
  controlnet=[_controlnet_pose, _controlnet_depth],
103
  torch_dtype=torch.float16,
 
130
  result = pipeline(
131
  prompt=enhanced_prompt,
132
  negative_prompt=enhanced_negative,
133
+ image=[pose_img, depth_img], # ← WICHTIG: control_image als Liste
134
+ controlnet_conditioning_scale=[0.7, 0.5],
 
 
 
135
  num_inference_steps=20,
136
  guidance_scale=7.0,
137
  generator=torch.Generator(device).manual_seed(seed),
138
  height=512,
139
  width=512,
140
  ).images[0]
141
+
142
 
143
  # Zurück auf Originalgröße
144
  if image.size != (512, 512):