Spaces:
Running on Zero
Running on Zero
File size: 6,104 Bytes
ee22178 3a3f89b ee22178 3a3f89b ee22178 3a3f89b ee22178 3a3f89b ee22178 2181622 ee22178 2181622 ee22178 2181622 ee22178 2181622 ee22178 3a3f89b ee22178 3a3f89b ee22178 3a3f89b ee22178 3a3f89b ee22178 3a3f89b ee22178 3a3f89b ee22178 3a3f89b ee22178 3a3f89b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | ---
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 |
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
```
|