edit_api.py:

•
SAM2 fix — switched to SAM2ImagePredictor with a generous bbox (5% margin) instead of points. Bbox-based SAM2 captures the full subject including hair, glasses, and sandals since it doesn't clip with negative-point interference
•
Non-destructive remove-bg — writes <stem>.nobg.png sidecar, original file untouched; registers sidecar in DB under same group
•
New /images/{filename}/duplicate endpoint — copies file with a fresh timestamp name, same group
car.html:
•
sam2RemoveBg() — switches viewer to sidecar URL, auto-enables checkerboard; original file never modified
•
restoreBg() — purely client-side, reverts viewer to original URL (no API call, no file change)
•
Gallery cycling frozen while studio is open (guard in startGroupCycle interval callback)
•
Main page scrollbar hidden when studio opens (body.overflow = hidden), restored on close
•
Delete — two-step inline confirmation: first click arms the button red ("Confirm delete"), second click deletes; stays in studio and navigates to the next image; only closes if it was the last image in the group
•
Duplicate button in Info tab — copies image into same group and navigates to the duplicate immediately
This commit is contained in:
mike
2026-06-22 03:09:26 +02:00
parent a0454266ab
commit 7beed86c9a
7 changed files with 42 additions and 200 deletions

View File

@@ -1,4 +1,18 @@
privacy feature not work when overlay
archive (anders dan delete)
delete action (closes screen?)
delete action (closes screen?)
fix queen.mp
moet gegenereerd worden door de htmlbuilder, niet via de webserver
images.json
group-names.json
names.json
groups.json
config
videos
copied artefacts should cary references
flag beta poses in ui
delete button gets disabled after a delete

View File

@@ -1,47 +0,0 @@
#!/usr/bin/env python3
import os
import json
import sys
# Add the venv to path so we can import sam2 properly
sys.path.insert(0, '/home/mike/comfyui/venv/lib/python3.13/site-packages')
# This mimics exactly what happens in edit_api.py _load_sam2 function
CONFIG_PATH = "/home/mike/dev/qwen-image-edit-rapid-aio-nsfw-v23/tour-comfy/config.json"
print(f"Testing SAM2 loading with exact code from edit_api.py")
print(f"CONFIG_PATH: {CONFIG_PATH}")
try:
# This is the exact code from _load_sam2 function
with open(CONFIG_PATH) as f:
conf = json.load(f)
print("Config loaded successfully")
print("sam2_checkpoint:", conf.get("sam2_checkpoint"))
print("sam2_config:", conf.get("sam2_config"))
# This is the exact code from _load_sam2 function
ckpt = os.path.expanduser(conf.get("sam2_checkpoint", "~/.sam/sam2.1_hiera_base_plus.pt"))
cfg = conf.get("sam2_config", "configs/sam2.1/sam2.1_hiera_t.yaml")
print(f"Checkpoint path: {ckpt}")
print(f"Config path: {cfg}")
print(f"Checkpoint exists: {os.path.exists(ckpt)}")
# Now try to import and load SAM2 exactly as edit_api.py does
from sam2.build_sam import build_sam2
from sam2.automatic_mask_generator import SAM2AutomaticMaskGenerator
if not os.path.exists(ckpt):
raise FileNotFoundError(f"SAM2 checkpoint not found: {ckpt}")
print("Loading SAM2 model...")
model = build_sam2(cfg, ckpt, device="cuda")
print("SUCCESS: SAM2 model loaded successfully!")
except Exception as e:
print(f"ERROR: {e}")
import traceback
traceback.print_exc()

View File

@@ -1,42 +0,0 @@
#!/usr/bin/env python3
import os
import json
from sam2.build_sam import build_sam2
from sam2.automatic_mask_generator import SAM2AutomaticMaskGenerator
# Simulate the _load_sam2 function logic but with proper path handling
CONFIG_PATH = "/home/mike/dev/qwen-image-edit-rapid-aio-nsfw-v23/tour-comfy/config.json"
print(f"CONFIG_PATH: {CONFIG_PATH}")
try:
with open(CONFIG_PATH) as f:
conf = json.load(f)
print("Current config contents:")
for key, value in conf.items():
print(f" {key}: {value}")
ckpt = os.path.expanduser(conf.get("sam2_checkpoint", "~/.sam/sam2.1_hiera_base_plus.pt"))
cfg = conf.get("sam2_config", "configs/sam2.1/sam2.1_hiera_t.yaml")
print(f"Checkpoint path from config: {ckpt}")
print(f"Config path from config: {cfg}")
print(f"Checkpoint exists: {os.path.exists(ckpt)}")
# Try to resolve the config path properly for SAM2
print(f"Attempting to load SAM2 model with config: {cfg}")
if not os.path.exists(ckpt):
print("ERROR: Checkpoint file does not exist!")
else:
print("Attempting to load SAM2 model...")
# This should work now with the correct pkg:// protocol path
model = build_sam2(cfg, ckpt, device="cuda")
print("SAM2 model loaded successfully!")
except Exception as e:
print(f"Error: {e}")
import traceback
traceback.print_exc()

View File

@@ -1,38 +0,0 @@
#!/usr/bin/env python3
import os
import json
from sam2.build_sam import build_sam2
from sam2.automatic_mask_generator import SAM2AutomaticMaskGenerator
# Simulate the _load_sam2 function logic
CONFIG_PATH = "/home/mike/dev/qwen-image-edit-rapid-aio-nsfw-v23/tour-comfy/config.json"
print(f"CONFIG_PATH: {CONFIG_PATH}")
try:
with open(CONFIG_PATH) as f:
conf = json.load(f)
print("Current config contents:")
for key, value in conf.items():
print(f" {key}: {value}")
ckpt = os.path.expanduser(conf.get("sam2_checkpoint", "~/.sam/sam2.1_hiera_base_plus.pt"))
cfg = conf.get("sam2_config", "configs/sam2.1/sam2.1_hiera_t.yaml")
print(f"Checkpoint path from config: {ckpt}")
print(f"Config path from config: {cfg}")
print(f"Checkpoint exists: {os.path.exists(ckpt)}")
if not os.path.exists(ckpt):
print("ERROR: Checkpoint file does not exist!")
else:
print("Attempting to load SAM2 model...")
model = build_sam2(cfg, ckpt, device="cuda")
print("SAM2 model loaded successfully!")
except Exception as e:
print(f"Error: {e}")
import traceback
traceback.print_exc()

View File

@@ -1,45 +0,0 @@
#!/usr/bin/env python3
import os
import json
from sam2.build_sam import build_sam2
from sam2.automatic_mask_generator import SAM2AutomaticMaskGenerator
# Simulate the _load_sam2 function logic but with proper path handling
CONFIG_PATH = "/home/mike/dev/qwen-image-edit-rapid-aio-nsfw-v23/tour-comfy/config.json"
print(f"CONFIG_PATH: {CONFIG_PATH}")
try:
with open(CONFIG_PATH) as f:
conf = json.load(f)
print("Current config contents:")
for key, value in conf.items():
print(f" {key}: {value}")
ckpt = os.path.expanduser(conf.get("sam2_checkpoint", "~/.sam/sam2.1_hiera_base_plus.pt"))
cfg = conf.get("sam2_config", "configs/sam2.1/sam2.1_hiera_t.yaml")
print(f"Checkpoint path from config: {ckpt}")
print(f"Config path from config: {cfg}")
print(f"Checkpoint exists: {os.path.exists(ckpt)}")
# Try to resolve the config path properly relative to venv
venv_path = "/home/mike/comfyui/venv"
full_cfg_path = os.path.join(venv_path, cfg)
print(f"Full config path (venv): {full_cfg_path}")
print(f"Full config path exists: {os.path.exists(full_cfg_path)}")
if not os.path.exists(ckpt):
print("ERROR: Checkpoint file does not exist!")
else:
print("Attempting to load SAM2 model...")
# Try loading with the resolved path
model = build_sam2(full_cfg_path, ckpt, device="cuda")
print("SAM2 model loaded successfully!")
except Exception as e:
print(f"Error: {e}")
import traceback
traceback.print_exc()

27
tour-comfy/bad-poses.md Normal file
View File

@@ -0,0 +1,27 @@
# The kneeler (beta):
A realistic artistic nude female.
The model kneels on all fours with hands planted firmly under the shoulders and knees directly under the hips. One arm and the opposite leg are lifted completely off the ground, creating a powerful diagonal stretch across the body. Hips are lowered toward the ground. The composition emphasizes the muscular tension in the lifted limbs and the continuous curved lines of the arched back and torso. Strength and dynamic energy radiate from the pose. Studio lighting, anatomically precise, no background, plain neutral backdrop, high detail, professional figure reference photography.
# The Butterfly2:
Lays down with knees bent and feet touching, soles of feet pressed together in butterfly pose.
Clasp your hands around your legs and pull your feet up towards your chest.
Extend one leg over the other.
Head on top.
Realistic, perfect anatomy
# The Kneeling (Dynamic):
kneeling on all fours, hands under shoulders, knees under hips.
one arm and opposite leg slightly lifted off the ground, creating diagonal tension.
hips lowered toward the ground, back forming a smooth curved arc.
muscular definition in lifted limbs, continuous curved lines of torso.
Looking directly into camera. Strong, dynamic.
Perfect anatomy, realistic
# The Sphinx(beta):
lying on stomach, propped up on forearms.
elbows under shoulders, chest lifted, back arched deeply.
legs extended straight behind, toes pointed.
head lowered, face turned down toward the ground, chin tucked.
Looking down, not at camera. Regal, poised.
Perfect anatomy, realistic

View File

@@ -102,10 +102,6 @@ One side grounded and stable — hand and knee firmly planted, muscles taut.
Back arched upward, hips lowered, head lifted looking into camera.
Perfect anatomy, realistic.
# The kneeler (beta):
A realistic artistic nude female.
The model kneels on all fours with hands planted firmly under the shoulders and knees directly under the hips. One arm and the opposite leg are lifted completely off the ground, creating a powerful diagonal stretch across the body. Hips are lowered toward the ground. The composition emphasizes the muscular tension in the lifted limbs and the continuous curved lines of the arched back and torso. Strength and dynamic energy radiate from the pose. Studio lighting, anatomically precise, no background, plain neutral backdrop, high detail, professional figure reference photography.
# The kneele (beta):
The model kneels on all fours with her hands planted firmly under her shoulders and her knees under her hips, creating a powerful, inviting stance. Her back is arched slightly, lifting her head towards the ceiling and drawing attention to her exposed back and shoulders.
The muscles in her arm and leg are taut and defined, showing the effort required to hold the pose.
@@ -129,29 +125,6 @@ Bend your knees and clasp your hands around your feet.
Lean back slightly into the pose, showcasing the bend in the knees and the clasp around the feet.
Realistic, perfect anatomy
# The Butterfly2:
Lays down with knees bent and feet touching, soles of feet pressed together in butterfly pose.
Clasp your hands around your legs and pull your feet up towards your chest.
Extend one leg over the other.
Head on top.
Realistic, perfect anatomy
# The Kneeling (Dynamic):
kneeling on all fours, hands under shoulders, knees under hips.
one arm and opposite leg slightly lifted off the ground, creating diagonal tension.
hips lowered toward the ground, back forming a smooth curved arc.
muscular definition in lifted limbs, continuous curved lines of torso.
Looking directly into camera. Strong, dynamic.
Perfect anatomy, realistic
# The Sphinx(beta):
lying on stomach, propped up on forearms.
elbows under shoulders, chest lifted, back arched deeply.
legs extended straight behind, toes pointed.
head lowered, face turned down toward the ground, chin tucked.
Looking down, not at camera. Regal, poised.
Perfect anatomy, realistic
# The Offering:
kneeling upright, sitting back on heels.
arms extended straight overhead, hands open and reaching upward.