Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

3.1 KB
Raw Blame
#!/usr/bin/env python3
"""
Generate src/lib/catalog/studio-packs.generated.ts from docs/research/parity-image-studios.json (the research
of the image studios: what each pack and template is, as facts about the product).

Outputs:
  PHOTODUMP_PACKS   — Photodump packs and Instadump packs: name, photo count, description.
  FASHION_TEMPLATES — Fashion Factory templates: name, shot count, description.

Each photo's prompt is Fuobe's own (src/lib/catalog/packs.ts). Soul's looks are generated by gen-soul-originals.py.
No ids, preview URLs or prompts of the original product are copied; Fuobe draws its own covers.

Run:  python3 scripts/gen-studio-packs.py
"""
import json
import re
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
RESEARCH = json.loads((ROOT / "docs/research/parity-image-studios.json").read_text())
OUT = ROOT / "src/lib/catalog/studio-packs.generated.ts"


def warn(msg):
    print(f"warning: {msg}")


def slug(s):
    return re.sub(r"[^a-z0-9]+", "-", s.lower()).strip("-")


def clean(s):
    return re.sub(r"\s+", " ", s or "").strip()


counts = RESEARCH["counts"]

packs = []
for t in RESEARCH["photodump"]["templates"]:
    version = t.get("version", "")
    if version.startswith("legacy"):
        continue  # the fixed 26-shot Soul v1 set; superseded by the packs below
    product = "instadump" if version.startswith("Instadump") else "photodump"
    packs.append({
        "id": slug(t["name"]),
        "name": t["name"],
        "count": t["count"],
        "description": clean(t["description"]),
        "inferred": t.get("descriptionSource") == "inferred",
        "product": product,
        **({"author": t["author"]} if t.get("author") else {}),
    })

templates = []
for t in sorted(RESEARCH["fashionFactory"]["templates"], key=lambda x: x.get("priority", 99)):
    templates.append({
        "id": slug(t["name"]),
        "name": t["name"],
        "shots": t["previewCount"],
        "description": clean(t["description"]),
        "inferred": t.get("descriptionSource") == "inferred",
    })
if len(templates) != counts["fashionFactoryTemplates"]:
    warn("fashion template count differs from research")

def ts(v):
    return json.dumps(v, ensure_ascii=False, indent=2)


OUT.write_text(
    "// GENERATED by scripts/gen-studio-packs.py from docs/research/parity-image-studios.json — do not edit.\n"
    "// Photodump / Instadump packs and Fashion Factory templates: names, photo counts and descriptions (`inferred` = ours).\n\n"
    "export interface PackMeta {\n  id: string;\n  name: string;\n  count: number;\n  description: string;\n  inferred: boolean;\n"
    "  product: \"photodump\" | \"instadump\";\n  author?: string;\n}\n\n"
    "export interface FashionTemplateMeta {\n  id: string;\n  name: string;\n  /** Shots in the template (Fuobe's photoset makes one photo per shot). */\n  shots: number;\n"
    "  description: string;\n  inferred: boolean;\n}\n\n"
    f"export const PHOTODUMP_PACKS: PackMeta[] = {ts(packs)};\n\n"
    f"export const FASHION_TEMPLATES: FashionTemplateMeta[] = {ts(templates)};\n"
)
print(f"wrote {OUT.relative_to(ROOT)}: {len(packs)} packs, {len(templates)} fashion templates")