Spaces:
Running on Zero
Running on Zero
Commit ·
5dbf2b4
1
Parent(s): aeda761
Tab1 face gen: head-and-shoulders framing w/ headroom (was extreme close-up), 512x768, anti-crop negatives (#42)
Browse files- Tab1 face gen: head-and-shoulders framing w/ headroom (was extreme close-up), 512x768, anti-crop negatives (518a6d6c646078246407d1591899ccb44e55837f)
Co-authored-by: pormungtailaw <pormungtai@users.noreply.huggingface.co>
app.py
CHANGED
|
@@ -248,15 +248,20 @@ def generate_face(model_id, prompt, translator):
|
|
| 248 |
import random as _r
|
| 249 |
seed = _r.randint(0, MAX_SEED)
|
| 250 |
p = pm.translate_prompt(prompt, translator)
|
| 251 |
-
#
|
| 252 |
-
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
try:
|
| 255 |
img = pm.run_generation(
|
| 256 |
cfg=cfg, mode="txt2img", prompt=p, negative_prompt=neg, ref_image=None,
|
| 257 |
steps=int(cfg.get("default_steps", 30)),
|
| 258 |
guidance=float(cfg.get("default_guidance", 5.0)),
|
| 259 |
-
denoise=0.4, ip_scale=0.7, width=512, height=
|
| 260 |
)
|
| 261 |
except Exception as e: # noqa
|
| 262 |
traceback.print_exc()
|
|
|
|
| 248 |
import random as _r
|
| 249 |
seed = _r.randint(0, MAX_SEED)
|
| 250 |
p = pm.translate_prompt(prompt, translator)
|
| 251 |
+
# Head-and-shoulders framing with headroom (NOT extreme close-up, which crops the
|
| 252 |
+
# top of the head). Put it first so it survives CLIP truncation.
|
| 253 |
+
p = ("RAW photo, upper body portrait, head and shoulders, full head in frame, "
|
| 254 |
+
"headroom above the head, centered, looking at viewer, " + p)
|
| 255 |
+
# push away from macro/cropped framings that cut the head off
|
| 256 |
+
neg = (cfg.get("negative_prompt", "") +
|
| 257 |
+
", (extreme close-up, macro, cropped head, head out of frame, "
|
| 258 |
+
"forehead cut off, face too close:1.3)")
|
| 259 |
try:
|
| 260 |
img = pm.run_generation(
|
| 261 |
cfg=cfg, mode="txt2img", prompt=p, negative_prompt=neg, ref_image=None,
|
| 262 |
steps=int(cfg.get("default_steps", 30)),
|
| 263 |
guidance=float(cfg.get("default_guidance", 5.0)),
|
| 264 |
+
denoise=0.4, ip_scale=0.7, width=512, height=768, seed=seed,
|
| 265 |
)
|
| 266 |
except Exception as e: # noqa
|
| 267 |
traceback.print_exc()
|