INNER CODE UNIT · Python

project_snapshot

GenielabsOpenSource/spine-animation-ai · reskin-app/app/backend/server.py:158

async def project_snapshot(request: Request, skin_name: str = Query(...)):
    """Save a frontend canvas snapshot as the AI input for a specific skin.

    Saved to `.genie/snapshots/{skin_name}.png`. The reskin pipeline reads
    this file as the source image for Gemini.
    """
    project = _State.require_project()
    body = await request.body()
    if not body:
        raise HTTPException(400, "empty body")
    snap_dir = project.workdir / "snapshots"
    snap_dir.mkdir(parents=True, exist_ok=True)
    out = snap_dir / f"{skin_name}.png"
    out.write_bytes(body)
    return {"ok": True, "size": len(body), "path": str(out.relative_to(project.path))}


@app.get("/api/project/file/{rel:path}")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…