Spaces:
Running on Zero
Running on Zero
File size: 3,409 Bytes
9e224e3 6506c82 9e224e3 6506c82 9e224e3 6506c82 9e224e3 6506c82 e5b3f19 6506c82 e5b3f19 6506c82 e5b3f19 6506c82 | 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 | ---
title: P-Q-Image-2.1-Remove-Object
emoji: 🧽
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 6.30.0
python_version: "3.12"
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_scopes:
- inference-api
- write-repos
short_description: Remove the object you point at, and nothing else
models:
- PrunaAI/P-Q-Image-2.1-Remove-Object
- PrunaAI/P-Q-Image-2.1-Remove-Object-Comfy
- PrunaAI/P-Q-Image-2.1
- Qwen/Qwen-Image-2.1
license: other
license_name: qwen-research
license_link: https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE
---
# P-Q-Image-2.1-Remove-Object
A LoRA for [`Qwen/Qwen-Image-2.1`](https://huggingface.co/Qwen/Qwen-Image-2.1) that removes the
object you point at and leaves the rest of the photo as it was. Paint a rough mask over the object,
say what it is, and it is replaced with what would be behind it, its shadow or reflection included.
- **`/` — Studio** (`gr.Server` API + custom UI, Pruna design, dark and light themes): paint the mask
with a brush and eraser, or let SAM 3 find it from the instruction, write the instruction, pick a variant; the card's 18 examples load photo,
mask and instruction in one click; before/after split view and run history.
- **`/workflow` — Workflow canvas** (`gr.Workflow`): photo + mask + instruction into a removal node,
chained into a second removal. To change the starter graph, edit `workflow.json`.
| Variant | Runs on | Steps | Strength | Working size |
|---|---|:---:|:---:|---|
| `6-step` (default) | [PrunaAI/P-Q-Image-2.1](https://huggingface.co/PrunaAI/P-Q-Image-2.1) 6-step v0.2 | 6 | 0.7 | photo's area, up to ~2 MP |
| `8-step` | [PrunaAI/P-Q-Image-2.1](https://huggingface.co/PrunaAI/P-Q-Image-2.1) 8-step v0.1 | 8 | 0.7 | photo's area, up to ~2 MP |
| `base` | the base model alone | 40 | 1.0 | photo's area, up to ~1 MP |
The mask is drawn as the red outline the model expects (`draw_outline.py`, from the model repo), and
the matching sentence is added to the instruction. With no mask, the instruction alone says what to
remove. No CFG.
**Text-guided masks.** Instead of painting, write the instruction and press *Auto-generate mask from instruction*:
[SAM 3](https://huggingface.co/facebook/sam3) masks every object the instruction names
(`text_mask.py`; "the phone on the right" picks one), and the mask lands on the canvas to touch up.
A run with nothing painted does this by itself, in the same GPU call as the removal, and falls back
to the instruction alone if SAM 3 finds nothing. `facebook/sam3` is gated: the Space needs an `HF_TOKEN` secret with
access, and without one it runs with painted masks only.
The `remove` API endpoint takes `source` and `mask` (uploaded file paths; mask white = remove, may
be empty), `instruction`, `variant`, `seed`, `randomize` and `auto_mask` (with no mask, find it from
the instruction with SAM 3; the mask found comes back as `mask_data`). The `find_mask` endpoint takes
`source` and `text` and returns the SAM 3 mask as `mask_data`.
Example photos are from [Unsplash](https://unsplash.com) (credits on the model card); the masks are
the card's own, except `c9`'s, rebuilt from its outlined input.
- Model card: [`PrunaAI/P-Q-Image-2.1-Remove-Object`](https://huggingface.co/PrunaAI/P-Q-Image-2.1-Remove-Object)
- ComfyUI: [`PrunaAI/P-Q-Image-2.1-Remove-Object-Comfy`](https://huggingface.co/PrunaAI/P-Q-Image-2.1-Remove-Object-Comfy)
|