auto-save 2026-05-13 11:23 (~4)
This commit is contained in:
18
api/main.py
18
api/main.py
@@ -1037,10 +1037,22 @@ def cleanup_frame(job_id: str, idx: int, req: CleanupReq | None = None) -> Job:
|
||||
if not frame_path.exists():
|
||||
raise HTTPException(404, "frame file missing")
|
||||
|
||||
region_phrase = _region_to_phrase(req.region) if (req and req.region) else ""
|
||||
if region_phrase:
|
||||
region_phrases: list[str] = []
|
||||
if req and req.regions:
|
||||
for r in req.regions:
|
||||
p = _region_to_phrase(r)
|
||||
if p:
|
||||
region_phrases.append(p)
|
||||
# 去重保序
|
||||
region_phrases = list(dict.fromkeys(region_phrases))
|
||||
|
||||
if region_phrases:
|
||||
if len(region_phrases) == 1:
|
||||
zones = f"the {region_phrases[0]} part"
|
||||
else:
|
||||
zones = "these parts: " + ", ".join(region_phrases)
|
||||
prompt = (
|
||||
f"Erase the text and graphics in the {region_phrase} part of the image. "
|
||||
f"Erase the text and graphics in {zones} of the image. "
|
||||
"Keep all other parts unchanged."
|
||||
)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user