--- title: MOSS-Image Workflow emoji: πŸ–Ό colorFrom: blue colorTo: indigo sdk: gradio sdk_version: 6.30.0 python_version: "3.12" app_file: app.py hf_oauth: true hf_oauth_scopes: - inference-api - write-repos pinned: false license: apache-2.0 tags: - ml-intern short_description: MOSS-Image text-to-image as a gr.Workflow node canvas. --- [![Built with ML Intern](https://huggingface.co/datasets/huggingface/badges/resolve/main/built-with-ml-intern-sm.svg)](https://hf.co/chat?mode=ml-intern) # MOSS-Image Workflow

Hugging Face Β· MOSS-Image-Base   Hugging Face Β· MOSS-Image-SFT   ModelScope Β· MOSS-Image-Base   ModelScope Β· MOSS-Image-SFT   GitHub   Homepage   Technical Report   Follow OpenMOSS on X   MOSS-Image QQ 亀桁羀:755535143   MOSS-Builders Feishu Community   MOSS-Image Discord Community

A [Gradio Workflow](https://www.gradio.app/guides/workflows) (node-canvas) version of the official [OpenMOSS-Team/MOSS-Image](https://huggingface.co/spaces/OpenMOSS-Team/MOSS-Image) demo, built on `gr.Workflow` in gradio 6.30.0, with the App view styled after the MOSS-Image landing page. ## Feature parity with the official demo Every sampling control of the original Space is a reference node wired into the `MOSS-Image Generate` function node: | Original demo | Here | |---|---| | Model dropdown (Base / SFT) | **Model** reference (`base` or `sft`); both checkpoints loaded at startup | | Prompt / Negative Prompt | **Prompt** / **Negative Prompt** references (same default text) | | Width Γ— Height (presets) | **Width** / **Height** references (multiples of 16) | | Steps / CFG / Shift / Seed | **Steps** / **CFG** / **Shift** / **Seed** references (`-1` = random) | | Images per prompt | **Images** reference β†’ gallery output | | Max text length | **Max Text Length** reference (1–4096) | | Skip-layer modes (Off / Negative-branch skipping / Standard SLG) | **Skip Layers** (`22` = negative-branch skipping, empty = off), **SLG Layers**, **SLG Scale**, **Skip Start**, **Skip Stop** references | | Example gallery with one-click restore | **Examples strip** under the hero: the original Space's 20 showcase images, hot-linked; clicking one fetches its `parameters.json` and restores prompt, model, size, sampling and SLG settings into the form | Not ported: showcase add/delete with live refresh (the Workflow App view is generated from the graph and has no upload-to-gallery mechanism), and ZeroGPU AOT compilation (this app runs the eager backend β€” set it up like the original if you need the extra speed). ## Design The App view is auto-generated by `gr.Workflow`, so the landing-page look is applied through `launch(theme=…, css=…, head=…)`: Inter type, a light gradient canvas, the official MOSS-Image lockup (light/dark aware) above the "Text-to-Image Generation with Native Layout Control" headline, a top nav with model/code links, and a Soft blue theme. The canvas view is untouched. ## Running it Generation runs on GPU via `@spaces.GPU(duration=80)` per node call, so this Space needs **ZeroGPU hardware** (Settings β†’ Hardware). `hf_oauth: true` is enabled so the owner can edit the canvas and signed-in visitors spend their own ZeroGPU quota; anonymous visitors fall back to the small shared allowance. Local development: ```bash pip install -r requirements.txt python app.py # full run, needs a CUDA GPU MOSS_WORKFLOW_PREVIEW=1 python app.py # canvas + styling only, no model download ``` The bundled `pipeline_moss_image.py` is copied verbatim from the [original Space](https://huggingface.co/spaces/OpenMOSS-Team/MOSS-Image) (BSD 3-Clause); model weights are Apache-2.0. The lockup artwork is hot-linked from the original Space's assets. The form is prefilled with showcase example 007 (the photorealistic Kazusa at a Tokyo crosswalk: 1184Γ—1776, 50 steps, CFG 3, shift 5, skip layer 22, seed 3537712559) so visitors can just hit **Run** and reproduce it exactly. Other defaults match the official demo: Euler sampling and negative-branch skipping. ## API example ```python from gradio_client import Client client = Client("akhaliq/moss-image-workflow") client.view_api() # exact parameters of /generated_images ```