modelbeast/server/operators/fal_image_edit/run.py
MODELBEAST 7ea3c8b935 fal panel: 5 new operators, image outputs, grouped UI, no-input ops + review fixes
Operators (16 total):
- fal_hunyuan3d_v21: Hunyuan3D 2.1 single-image (live-verified dash variant,
  ~90s; v21 multi-view is broken on fal — v2 stays the multi-view path)
- fal_bg_remove (BiRefNet v2): subject cutout pre-pass — the biggest quality
  lever before image->3D
- fal_upscale (SeedVR faithful upscale), fal_image_edit (nano-banana prompt
  edits), fal_text_image (Ideogram v3 — first no-input operator)
- fal_common: collect='images' mode; recursive URL extractor now takes the
  wanted extension set

UI: operator dropdown grouped by category (optgroup); operators with
accepts: [] run without a selected asset ('No input asset needed' note);
run-button/launch logic updated accordingly.

Review fixes (Opus Phase 1 commit):
- runner._run_lane crashed (TypeError) when a queued job was deleted before
  the worker picked it up
- PUT /api/settings treated empty string as a masked placeholder, making
  secrets impossible to clear from the UI
- store.register_file mutated the caller's meta dict via pop

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 21:51:16 +10:00

23 lines
645 B
Python

import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from _lib import fal_common # noqa: E402
a, p = fal_common.parse_args()
if not p.get("prompt"):
print("ERROR: prompt is required — describe the edit you want")
sys.exit(1)
stem = Path(a.input[0]).stem if a.input else "image"
fal_common.run(
endpoint="fal-ai/nano-banana/edit",
arguments={"prompt": p["prompt"]},
outdir=a.outdir,
image_path=a.input[0] if a.input else None,
image_arg="image_urls",
image_as_list=True,
extra_args=p.get("extra_args"),
out_stem=f"{stem}_edited",
collect="images",
)