--- title: OpenHTR-Gen emoji: ✍️ colorFrom: red colorTo: yellow sdk: gradio sdk_version: 5.35.0 app_file: app.py pinned: false license: other short_description: Rewrite any handwritten region in the page's style models: - black-forest-labs/FLUX.1-Fill-dev - OpenHTR/OpenHTR-Gen-LoRA tags: - spaces - zero-gpu - handwriting - flux - text-rendering --- # OpenHTR-Gen **English** | [中文](README_zh.md) Rewrite a region of a Chinese handwritten page in its own handwriting style. Upload a full-page Chinese handwriting scan, draw a box over the text you want to change, and type the new text. OpenHTR-Gen re-renders that region so the strokes, ink and paper match the rest of the page, then returns the generated crop. ## How to use 1. **Upload** a full-page handwriting image. 2. **Select the region.** Use the brush to trace around the text (or paint over it) — the box is the bounding box of your strokes. Brush size and colour are in the editor toolbar. 3. **Type the new text** (up to 35 characters). 4. **Click Generate.** You get the edited crop, plus a preview of the whole page with the result pasted back in. ## Settings | Control | Default | What it does | | --- | --- | --- | | Inference steps | 20 | More steps → more detail, slower | | guidance_scale | 30 | How strongly the new characters are followed | | Seed | -1 | -1 = random; fix it to reproduce a result | | Crop padding | 0 | Margin around the output crop | | Selection padding | 4 px | Expands the detected box | | x0 / y0 / x1 / y1 | 0 | Manual box in image pixels; overrides the brush | ## Tips - Leave a little vertical space inside the box so the new text can blend with neighbouring strokes. - A generous outline or a filled-in stroke works better than a hairline rectangle. - If a result looks off, fix nothing but the seed and try again. ## Notes - Generation is probabilistic — an occasional garbled character is expected. - Very large pages work, but editing them in the browser may feel slow. - FLUX.1 [dev] is released under a **non-commercial** license. Do not use this demo or its outputs commercially.