This commit is contained in:
2026-05-14 18:37:18 +08:00
parent 5e6d8046e1
commit 7a2ffc91a2
15 changed files with 200 additions and 56 deletions
+7 -3
View File
@@ -15,7 +15,7 @@ router = APIRouter(tags=["inpaint"])
@router.post("/inpaint")
def inpaint(req: InpaintRequest) -> Dict[str, Any]:
try:
model_name = req.model_name or "sdxl_inpaint"
model_name = req.model_name or "flux_fill"
pil = b64_to_pil_image(req.image_b64).convert("RGB")
if req.mask_b64:
@@ -24,13 +24,17 @@ def inpaint(req: InpaintRequest) -> Dict[str, Any]:
mask = default_half_mask(pil)
predictor = get_inpaint_predictor(model_name)
call_kw: Dict[str, Any] = {"strength": req.strength, "max_side": req.max_side}
if req.guidance_scale is not None:
call_kw["guidance_scale"] = req.guidance_scale
if req.num_inference_steps is not None:
call_kw["num_inference_steps"] = req.num_inference_steps
out = predictor(
pil,
mask,
req.prompt or "",
req.negative_prompt or "",
strength=req.strength,
max_side=req.max_side,
**call_kw,
)
out_dir = OUTPUT_DIR / "inpaint"