Jingzhi Ye commited on
Commit Β·
3bb4e64
1
Parent(s): 9e67084
Update readme
Browse files
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
|
@@ -8,16 +8,82 @@ sdk_version: 6.16.0
|
|
| 8 |
python_version: '3.12'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
| 16 |
-
vision model (MiniCPM-V-4.6) judges each doodle against the requested object
|
| 17 |
-
and its line-drawable properties. Earn stars to open harder, higher-paying
|
| 18 |
-
slots and pay off your debt before the deadline.
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: InkWitch
|
| 3 |
+
emoji: πͺ
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
|
|
|
| 8 |
python_version: '3.12'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
+
tags:
|
| 12 |
+
- track:wood
|
| 13 |
+
- sponsor:openbmb
|
| 14 |
+
- achievement:offgrid
|
| 15 |
+
- achievement:offbrand
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# πͺ InkWitch
|
| 19 |
|
| 20 |
+
> **Build Small Hackathon submission**. *An Adventure in Thousand Token Wood* Track
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
Your research grant is running dry, and the loan shark has sent you an ultimatum for the debt.
|
| 23 |
+
He repossessed your lab and turned it into a witchcraft store.
|
| 24 |
|
| 25 |
+
To keep your roof and clear the debt, you serve the customers who wander in β each wants an object with a few specific
|
| 26 |
+
qualities, *a key with wings*, *a mug with a cat face*, etc.
|
| 27 |
+
|
| 28 |
+
Sketch glyphs and transmute them to fulfill the customers' orders, so you can receive payment and build your reputation. But watch out, every stroke drains your mana. Reinvest wisely, sketch sparingly, and DON'T GO BANKRUPT!
|
| 29 |
+
|
| 30 |
+
## Model Pipeline
|
| 31 |
+
1. **Glyph appraisal** β `MiniCPM-V-4.6` looks at your raw glyph and scores it
|
| 32 |
+
for *recognition* (is it the right object at all?) plus a confidence on each
|
| 33 |
+
requested *quality*.
|
| 34 |
+
2. **Transmutation** β if the object is recognized, your glyph is fed as a
|
| 35 |
+
scribble control image into an `SDXL-Flash + Scribble-ControlNet` pipeline,
|
| 36 |
+
which renders a finished illustration that follows your lines.
|
| 37 |
+
3. **Re-check** β the VLM then re-judges the *transmuted image*, but only on the
|
| 38 |
+
qualities your glyph **failed**.
|
| 39 |
+
Your gold and reputation reflect this final artwork β so a rough glyph that
|
| 40 |
+
the transmutation fleshes out faithfully can win back reputation it missed.
|
| 41 |
+
|
| 42 |
+
In other words, you're judged not just on what you drew, but on what your glyph
|
| 43 |
+
*becomes*. The AI is load-bearing twice over: once as the judge, once as the artist.
|
| 44 |
+
|
| 45 |
+
## Models (all running on the Space β Off the Grid)
|
| 46 |
+
|
| 47 |
+
| Role | Model | Params |
|
| 48 |
+
|---|---|---|
|
| 49 |
+
| Vision judge | [`openbmb/MiniCPM-V-4.6`](https://huggingface.co/openbmb/MiniCPM-V-4.6) | ~1.3B |
|
| 50 |
+
| Image generator | [`sd-community/sdxl-flash`](https://huggingface.co/sd-community/sdxl-flash) | ~2.6B |
|
| 51 |
+
| Scribble control | [`xinsir/controlnet-scribble-sdxl-1.0`](https://huggingface.co/xinsir/controlnet-scribble-sdxl-1.0) | ~1.25B |
|
| 52 |
+
| VAE | [`madebyollin/sdxl-vae-fp16-fix`](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix) | ~84M |
|
| 53 |
+
|
| 54 |
+
The image pipeline is adapted from
|
| 55 |
+
[`linoyts/scribble-sdxl-flash`](https://huggingface.co/spaces/linoyts/scribble-sdxl-flash).
|
| 56 |
+
No external inference APIs are called β both heavy models are eagerly loaded at
|
| 57 |
+
Space startup and every appraisal + transmutation happens inside one `@spaces.GPU`
|
| 58 |
+
acquisition.
|
| 59 |
+
|
| 60 |
+
## Tech Notes
|
| 61 |
+
|
| 62 |
+
- **Custom frontend on `gr.Server`** β `/` serves a hand-written `index.html` +
|
| 63 |
+
`app.js` + `style.css` (the drawing canvas, shop, and night phase), driven
|
| 64 |
+
through the official `@gradio/client` so ZeroGPU per-user quota is attributed
|
| 65 |
+
correctly. `app.launch(ssr_mode=False)` keeps Gradio's SSR from shadowing it.
|
| 66 |
+
- **Per-user state** is keyed on `gr.Request.session_hash`, so simultaneous
|
| 67 |
+
players get independent games.
|
| 68 |
+
- **One GPU call per Transmute** β glyph appraisal, transmutation, and re-check
|
| 69 |
+
are fused into a single `@spaces.GPU` function.
|
| 70 |
+
|
| 71 |
+
## π₯ Demo video
|
| 72 |
+
|
| 73 |
+
> _Placeholder β demo video coming before the June 15 2026 deadline._
|
| 74 |
+
|
| 75 |
+
## π£ Social post
|
| 76 |
+
|
| 77 |
+
> _Placeholder β link to the social-media post coming soon._
|
| 78 |
+
|
| 79 |
+
## Run it locally
|
| 80 |
+
|
| 81 |
+
```bash
|
| 82 |
+
# With the real models (needs a CUDA GPU):
|
| 83 |
+
python app.py
|
| 84 |
+
|
| 85 |
+
# No GPU? Use the mock vision backend (image-gen disabled):
|
| 86 |
+
WITCH_WOOD_MOCK=1 python app.py
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
Runs on Hugging Face Spaces **ZeroGPU** in production.
|