Spaces:
Running
Running
Commit ·
f25d3bf
1
Parent(s): 74dd70d
Make glasses transfer opt-in — it was disfiguring glasses-wearing sources
Browse filestransfer_glasses warps the source's spectacles onto the swapped face using a
two-point eye transform. Run against a real source who wears glasses, that lands
as a semi-transparent, misaligned lens shape floating over the face rather than
as spectacles: clearly worse than the clean swap beside it, which simply doesn't
carry the glasses over.
It was on by default, so every glasses-wearing user got that. Now opt-in via
keep_glasses=1, matching how head swap and hair transfer are already gated. Both
the request default and the worker default were changed, or one would have
overridden the other.
14 tests pass.
767 unmodified lines768769770771771772773774159 unmodified lines934935936937938937938939940941942943944945767 unmodified lines "name": (request.form.get("name") or "").strip(), "head_swap": request.form.get("head_swap", "0"), "swap_hair": request.form.get("swap_hair", "1"), "keep_glasses": request.form.get("keep_glasses", "1"), "keep_glasses": request.form.get("keep_glasses", "0"), } job_id = _jobs.submit(source, target, opts) return jsonify({"ok": True, "job_id": job_id, "state": "queued"}), 202159 unmodified lines except Exception as e: print(f"[swap] hair compose error: {e}")
# 6. Glasses (no-op if the source isn't wearing any). if opts.get("keep_glasses", "1") in ("1", "true", "on"): # 6. Glasses — OPT-IN (keep_glasses=1). It warps the source's spectacles # onto the swapped face via a 2-point eye transform, and on a real # glasses-wearing source that lands as a semi-transparent, misaligned # lens shape floating over the face. Without it the result is clean; # the swap simply doesn't carry the glasses over. if opts.get("keep_glasses", "0") in ("1", "true", "on"): try: swapped = transfer_glasses(swapped, source) except Exception as e:web_app.py+7-3