Spaces:
Running on Zero
Download README.md from OpenMOSS-Team/MOSS-Image: direct link, hf CLI and curl.
- Browser
- Download file 7.03 kB
-
https://huggingface.co/spaces/OpenMOSS-Team/MOSS-Image/resolve/refs%2Fpr%2F2/README.md
- Command line
-
hf download hf://spaces/OpenMOSS-Team/MOSS-Image@refs/pr/2/README.md
-
curl -L -o README.md https://huggingface.co/spaces/OpenMOSS-Team/MOSS-Image/resolve/refs%2Fpr%2F2/README.md
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.
MOSS-Image Workflow
A Gradio Workflow (node-canvas) version of the official
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 |
| — | Turbo mode: set Model to turbo for the 4-step distilled LoRA (see below) |
Turbo (4-step) mode
Set the Model field to turbo to run the 4-step distilled LoRA from
akhaliq/MOSS-Image-SFT-4-steps
(distilled via data-space/Euler-native DMD, arXiv:2610.12102)
— roughly 10x faster per image than the 50-step sampler.
- The fp32 LoRA is wrapped on the SFT transformer at startup, unmerged
(
turbo_lora.py, vendored from the model repo), and toggled per request by its alpha — so Base and SFT generations are unchanged, and no third transformer is loaded into GPU memory. - Turbo always runs at CFG 1; the negative prompt is ignored.
- Left at the default 50, Steps auto-maps by resolution per the model card: 4 up to 1024px, 6 at ~1536px, 8 at 2048px. Set Steps yourself to override.
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:
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 (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
from gradio_client import Client
client = Client("akhaliq/moss-image-workflow")
client.view_api() # exact parameters of /generated_images