Spaces:
Running on Zero
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
7.03 kB
| 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. | |
| [](https://hf.co/chat?mode=ml-intern) | |
| # MOSS-Image Workflow | |
| <p align="center"> | |
| <a href="https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base"><img alt="Hugging Face · MOSS-Image-Base" src="https://img.shields.io/badge/🤗%20Hugging%20Face-MOSS--Image--Base-ffc107?style=flat-square"></a> | |
| | |
| <a href="https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT"><img alt="Hugging Face · MOSS-Image-SFT" src="https://img.shields.io/badge/🤗%20Hugging%20Face-MOSS--Image--SFT-ffc107?style=flat-square"></a> | |
| | |
| <a href="https://modelscope.cn/models/openmoss/MOSS-Image-Base"><img alt="ModelScope · MOSS-Image-Base" src="assets/modelscope-base-badge.svg"></a> | |
| | |
| <a href="https://modelscope.cn/models/openmoss/MOSS-Image-SFT"><img alt="ModelScope · MOSS-Image-SFT" src="assets/modelscope-sft-badge.svg"></a> | |
| | |
| <a href="https://github.com/OpenMOSS/MOSS-Image"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-Code-181717?style=flat-square&logo=github&logoColor=white"></a> | |
| | |
| <a href="https://openmoss.github.io/MOSS-Image/"><img alt="Homepage" src="https://img.shields.io/badge/🌐%20Project-Homepage-2563eb?style=flat-square"></a> | |
| | |
| <a href="https://github.com/OpenMOSS/MOSS-Image/blob/main/paper/MOSS_Image_Technical_Report.pdf"><img alt="Technical Report" src="https://img.shields.io/badge/📄%20Paper-Technical_Report-b31b1b?style=flat-square"></a> | |
| | |
| <a href="https://x.com/Open_MOSS"><img alt="Follow OpenMOSS on X" src="https://img.shields.io/badge/Follow-OpenMOSS-000000?style=flat-square&logo=x&logoColor=white"></a> | |
| | |
| <a href="https://qm.qq.com/q/hphM7VhaDu"><img alt="MOSS-Image QQ 交流群:755535143" src="https://img.shields.io/badge/QQ-755535143-12B7F5?style=flat-square&logo=qq&logoColor=white"></a> | |
| | |
| <a href="https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=7a3m2007-815f-409b-9c3d-a4129f5c058e"><img alt="MOSS-Builders Feishu Community" src="assets/feishu-builders-badge.svg"></a> | |
| | |
| <a href="https://discord.gg/nXFWEyvbb"><img alt="MOSS-Image Discord Community" src="https://img.shields.io/badge/Discord-Community-5865F2?style=flat-square&logo=discord&logoColor=white"></a> | |
| </p> | |
| 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 | | |
| | — | **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](https://huggingface.co/akhaliq/MOSS-Image-SFT-4-steps) | |
| (distilled via data-space/Euler-native DMD, [arXiv:2610.12102](https://arxiv.org/abs/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: | |
| ```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 | |
| ``` | |