Spaces:
Running on Zero
Running on Zero
Upload folder using huggingface_hub
Browse files- README.md +24 -31
- app.py +162 -19
- examples/samples.json +7 -8
- examples/style_1.png +0 -0
- examples/style_2.png +0 -0
- examples/style_3.png +0 -0
- examples/style_4.png +0 -0
README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
---
|
| 2 |
title: Eruku - Styled Text Generation
|
| 3 |
emoji: ποΈ
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 4.44.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: true
|
| 10 |
license: apache-2.0
|
|
@@ -15,51 +15,44 @@ tags:
|
|
| 15 |
- styled-text
|
| 16 |
- text-to-image
|
| 17 |
- autoregressive
|
|
|
|
| 18 |
short_description: Generate handwritten text in any style
|
| 19 |
---
|
| 20 |
|
| 21 |
-
# Eruku - Autoregressive Styled Text Image Generation
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
- **
|
| 30 |
-
- **
|
|
|
|
| 31 |
|
| 32 |
## How to Use
|
| 33 |
|
| 34 |
-
1. Upload a handwriting
|
| 35 |
-
2. Optionally enter the text from the style image
|
| 36 |
3. Enter the text you want to generate
|
| 37 |
4. Click Generate!
|
| 38 |
|
| 39 |
## Citation
|
| 40 |
|
| 41 |
```bibtex
|
| 42 |
-
@
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
@inproceedings{zaccagnino2026autoregressive,
|
| 52 |
-
author = {Carmine Zaccagnino and Fabio Quattrini and Vittorio Pippi and Silvia Cascianelli and Alessio Tonioni and Rita Cucchiara},
|
| 53 |
-
title = {Autoregressive Styled Text Image Generation, but Make it Reliable},
|
| 54 |
-
booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision},
|
| 55 |
-
month = {March},
|
| 56 |
-
year = {2026}
|
| 57 |
}
|
| 58 |
```
|
| 59 |
|
| 60 |
-
##
|
| 61 |
|
| 62 |
-
|
| 63 |
-
- π [Website](https://eruku.carminezacc.com)
|
| 64 |
-
- π€ [Model](https://huggingface.co/blowing-up-groundhogs/eruku)
|
| 65 |
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Eruku - Styled Text Generation
|
| 3 |
emoji: ποΈ
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: true
|
| 10 |
license: apache-2.0
|
|
|
|
| 15 |
- styled-text
|
| 16 |
- text-to-image
|
| 17 |
- autoregressive
|
| 18 |
+
- WACV2026
|
| 19 |
short_description: Generate handwritten text in any style
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# ποΈ Eruku - Autoregressive Styled Text Image Generation
|
| 23 |
|
| 24 |
+
**Autoregressive Styled Text Image Generation, but Make it Reliable**
|
| 25 |
|
| 26 |
+
WACV 2026 | [Paper](https://arxiv.org/abs/2510.23240) | [Project Page](https://eruku.carminezacc.com) | [Model](https://huggingface.co/blowing-up-groundhogs/eruku)
|
| 27 |
|
| 28 |
+
## Key Features
|
| 29 |
+
|
| 30 |
+
- **π― Optional Style Text**: Unlike previous methods, Eruku works without requiring transcription of the style image
|
| 31 |
+
- **π Explicit Stopping**: Dedicated end-of-generation token prevents repetition artifacts
|
| 32 |
+
- **β¨ CFG-Guided**: Classifier-Free Guidance for better text adherence
|
| 33 |
|
| 34 |
## How to Use
|
| 35 |
|
| 36 |
+
1. Upload a handwriting sample as the style image
|
| 37 |
+
2. Optionally enter the text from the style image (helps but not required!)
|
| 38 |
3. Enter the text you want to generate
|
| 39 |
4. Click Generate!
|
| 40 |
|
| 41 |
## Citation
|
| 42 |
|
| 43 |
```bibtex
|
| 44 |
+
@inproceedings{zaccagnino2026eruku,
|
| 45 |
+
title={{Autoregressive Styled Text Image Generation, but Make it Reliable}},
|
| 46 |
+
author={Zaccagnino, Carmine and Quattrini, Fabio and Pippi, Vittorio
|
| 47 |
+
and Cascianelli, Silvia and Tonioni, Alessio and Cucchiara, Rita},
|
| 48 |
+
booktitle={Proceedings of the IEEE/CVF Winter Conference on
|
| 49 |
+
Applications of Computer Vision (WACV)},
|
| 50 |
+
year={2026}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
}
|
| 52 |
```
|
| 53 |
|
| 54 |
+
## Authors
|
| 55 |
|
| 56 |
+
Carmine Zaccagnino, Fabio Quattrini, Vittorio Pippi, Silvia Cascianelli, Alessio Tonioni, Rita Cucchiara
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
University of Modena and Reggio Emilia | Google
|
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
"""
|
| 2 |
-
Eruku Demo - Autoregressive Styled Text Image Generation
|
|
|
|
| 3 |
"""
|
| 4 |
|
| 5 |
import gradio as gr
|
|
@@ -100,24 +101,166 @@ def generate_handwriting(style_image, style_text, gen_text):
|
|
| 100 |
return None, f"β Error: {str(e)}"
|
| 101 |
|
| 102 |
|
| 103 |
-
#
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
if __name__ == "__main__":
|
| 123 |
demo.launch()
|
|
|
|
| 1 |
"""
|
| 2 |
+
Eruku Demo - Autoregressive Styled Text Image Generation, but Make it Reliable
|
| 3 |
+
WACV 2026
|
| 4 |
"""
|
| 5 |
|
| 6 |
import gradio as gr
|
|
|
|
| 101 |
return None, f"β Error: {str(e)}"
|
| 102 |
|
| 103 |
|
| 104 |
+
# Custom CSS for better styling
|
| 105 |
+
custom_css = """
|
| 106 |
+
.gradio-container {
|
| 107 |
+
max-width: 1200px !important;
|
| 108 |
+
}
|
| 109 |
+
.header-text {
|
| 110 |
+
text-align: center;
|
| 111 |
+
margin-bottom: 1rem;
|
| 112 |
+
}
|
| 113 |
+
.feature-box {
|
| 114 |
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
| 115 |
+
border-radius: 10px;
|
| 116 |
+
padding: 15px;
|
| 117 |
+
margin: 10px 0;
|
| 118 |
+
}
|
| 119 |
+
footer {
|
| 120 |
+
visibility: hidden;
|
| 121 |
+
}
|
| 122 |
+
"""
|
| 123 |
+
|
| 124 |
+
# Build the interface with gr.Blocks for better customization
|
| 125 |
+
with gr.Blocks(css=custom_css, title="Eruku - Styled Text Generation") as demo:
|
| 126 |
+
|
| 127 |
+
# Header
|
| 128 |
+
gr.HTML("""
|
| 129 |
+
<div style="text-align: center; margin-bottom: 20px;">
|
| 130 |
+
<h1>ποΈ Eruku</h1>
|
| 131 |
+
<h3 style="color: #888; font-weight: normal;">Autoregressive Styled Text Image Generation, but Make it Reliable</h3>
|
| 132 |
+
<p style="color: #666;">
|
| 133 |
+
<strong>WACV 2026</strong> |
|
| 134 |
+
Carmine Zaccagnino, Fabio Quattrini, Vittorio Pippi, Silvia Cascianelli, Alessio Tonioni, Rita Cucchiara
|
| 135 |
+
</p>
|
| 136 |
+
<p>
|
| 137 |
+
<a href="https://arxiv.org/abs/2510.23240" target="_blank">π Paper</a> |
|
| 138 |
+
<a href="https://eruku.carminezacc.com" target="_blank">π Project Page</a> |
|
| 139 |
+
<a href="https://huggingface.co/blowing-up-groundhogs/eruku" target="_blank">π€ Model</a> |
|
| 140 |
+
<a href="https://github.com/aimagelab/Emuru" target="_blank">π» Code</a>
|
| 141 |
+
</p>
|
| 142 |
+
</div>
|
| 143 |
+
""")
|
| 144 |
+
|
| 145 |
+
# Key features
|
| 146 |
+
gr.HTML("""
|
| 147 |
+
<div style="display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px;">
|
| 148 |
+
<div style="background: #1e3a5f; padding: 10px 20px; border-radius: 8px; text-align: center;">
|
| 149 |
+
<strong>π― Optional Style Text</strong><br>
|
| 150 |
+
<small>Works without transcription</small>
|
| 151 |
+
</div>
|
| 152 |
+
<div style="background: #1e3a5f; padding: 10px 20px; border-radius: 8px; text-align: center;">
|
| 153 |
+
<strong>π Explicit Stopping</strong><br>
|
| 154 |
+
<small>No repetition artifacts</small>
|
| 155 |
+
</div>
|
| 156 |
+
<div style="background: #1e3a5f; padding: 10px 20px; border-radius: 8px; text-align: center;">
|
| 157 |
+
<strong>β¨ CFG-Guided</strong><br>
|
| 158 |
+
<small>Better text adherence</small>
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
""")
|
| 162 |
+
|
| 163 |
+
with gr.Row():
|
| 164 |
+
with gr.Column(scale=1):
|
| 165 |
+
style_image_input = gr.Image(
|
| 166 |
+
label="π· Style Image",
|
| 167 |
+
type="pil",
|
| 168 |
+
height=200
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
style_text_input = gr.Textbox(
|
| 172 |
+
label="π Style Text (Optional)",
|
| 173 |
+
placeholder="Transcription of text in the style image. Leave empty if unknown - Eruku works without it!",
|
| 174 |
+
lines=2
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
gen_text_input = gr.Textbox(
|
| 178 |
+
label="βοΈ Text to Generate",
|
| 179 |
+
placeholder="Enter the text you want to generate in the selected style",
|
| 180 |
+
lines=3,
|
| 181 |
+
value="Hello, World!"
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
generate_btn = gr.Button("π Generate", variant="primary", size="lg")
|
| 185 |
+
|
| 186 |
+
with gr.Column(scale=1):
|
| 187 |
+
output_image = gr.Image(
|
| 188 |
+
label="π¨ Generated Output",
|
| 189 |
+
type="pil",
|
| 190 |
+
height=200
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
+
status_text = gr.Textbox(
|
| 194 |
+
label="Status",
|
| 195 |
+
lines=1,
|
| 196 |
+
interactive=False
|
| 197 |
+
)
|
| 198 |
+
|
| 199 |
+
# Examples
|
| 200 |
+
examples = load_examples()
|
| 201 |
+
if examples:
|
| 202 |
+
gr.Examples(
|
| 203 |
+
examples=examples,
|
| 204 |
+
inputs=[style_image_input, style_text_input, gen_text_input],
|
| 205 |
+
label="π Example Styles (IAM Dataset - Line Level)",
|
| 206 |
+
examples_per_page=4
|
| 207 |
+
)
|
| 208 |
+
|
| 209 |
+
# Connect events
|
| 210 |
+
generate_btn.click(
|
| 211 |
+
fn=generate_handwriting,
|
| 212 |
+
inputs=[style_image_input, style_text_input, gen_text_input],
|
| 213 |
+
outputs=[output_image, status_text]
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
gen_text_input.submit(
|
| 217 |
+
fn=generate_handwriting,
|
| 218 |
+
inputs=[style_image_input, style_text_input, gen_text_input],
|
| 219 |
+
outputs=[output_image, status_text]
|
| 220 |
+
)
|
| 221 |
+
|
| 222 |
+
# How to use section
|
| 223 |
+
gr.Markdown("""
|
| 224 |
+
---
|
| 225 |
+
### π How to Use
|
| 226 |
+
|
| 227 |
+
1. **Upload a style image**: A handwritten text sample whose writing style you want to replicate
|
| 228 |
+
2. **Style text (optional)**: The transcription of the style image. Unlike previous methods, **Eruku works without it!**
|
| 229 |
+
3. **Enter generation text**: The text you want to render in the extracted style
|
| 230 |
+
4. **Click Generate**: Eruku will produce text in the style of your reference image
|
| 231 |
+
|
| 232 |
+
---
|
| 233 |
+
### π Citation
|
| 234 |
+
|
| 235 |
+
If you use Eruku in your research, please cite:
|
| 236 |
+
|
| 237 |
+
```bibtex
|
| 238 |
+
@inproceedings{zaccagnino2026eruku,
|
| 239 |
+
title={{Autoregressive Styled Text Image Generation, but Make it Reliable}},
|
| 240 |
+
author={Zaccagnino, Carmine and Quattrini, Fabio and Pippi, Vittorio
|
| 241 |
+
and Cascianelli, Silvia and Tonioni, Alessio and Cucchiara, Rita},
|
| 242 |
+
booktitle={Proceedings of the IEEE/CVF Winter Conference on
|
| 243 |
+
Applications of Computer Vision (WACV)},
|
| 244 |
+
year={2026}
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
@InProceedings{pippi2025zeroshot,
|
| 248 |
+
author = {Pippi, Vittorio and Quattrini, Fabio and Cascianelli, Silvia
|
| 249 |
+
and Tonioni, Alessio and Cucchiara, Rita},
|
| 250 |
+
title = {Zero-Shot Styled Text Image Generation, but Make It Autoregressive},
|
| 251 |
+
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision
|
| 252 |
+
and Pattern Recognition (CVPR)},
|
| 253 |
+
year = {2025},
|
| 254 |
+
pages = {7910-7919}
|
| 255 |
+
}
|
| 256 |
+
```
|
| 257 |
+
|
| 258 |
+
---
|
| 259 |
+
<p style="text-align: center; color: #888;">
|
| 260 |
+
Built by <a href="https://aimagelab.ing.unimore.it/" target="_blank">AImageLab</a> @ University of Modena and Reggio Emilia
|
| 261 |
+
</p>
|
| 262 |
+
""")
|
| 263 |
+
|
| 264 |
|
| 265 |
if __name__ == "__main__":
|
| 266 |
demo.launch()
|
examples/samples.json
CHANGED
|
@@ -1,23 +1,22 @@
|
|
| 1 |
[
|
| 2 |
{
|
| 3 |
-
"style_image": "examples/
|
| 4 |
"style_text": "",
|
| 5 |
"gen_text": "The quick brown fox jumps over the lazy dog"
|
| 6 |
},
|
| 7 |
{
|
| 8 |
-
"style_image": "examples/
|
| 9 |
"style_text": "",
|
| 10 |
-
"gen_text": "
|
| 11 |
},
|
| 12 |
{
|
| 13 |
-
"style_image": "examples/
|
| 14 |
"style_text": "",
|
| 15 |
-
"gen_text": "
|
| 16 |
},
|
| 17 |
{
|
| 18 |
-
"style_image": "examples/
|
| 19 |
"style_text": "",
|
| 20 |
-
"gen_text": "
|
| 21 |
}
|
| 22 |
]
|
| 23 |
-
|
|
|
|
| 1 |
[
|
| 2 |
{
|
| 3 |
+
"style_image": "examples/style_1.png",
|
| 4 |
"style_text": "",
|
| 5 |
"gen_text": "The quick brown fox jumps over the lazy dog"
|
| 6 |
},
|
| 7 |
{
|
| 8 |
+
"style_image": "examples/style_2.png",
|
| 9 |
"style_text": "",
|
| 10 |
+
"gen_text": "Artificial intelligence is transforming the world"
|
| 11 |
},
|
| 12 |
{
|
| 13 |
+
"style_image": "examples/style_3.png",
|
| 14 |
"style_text": "",
|
| 15 |
+
"gen_text": "Hello from the Eruku handwriting generation model"
|
| 16 |
},
|
| 17 |
{
|
| 18 |
+
"style_image": "examples/style_4.png",
|
| 19 |
"style_text": "",
|
| 20 |
+
"gen_text": "Machine learning enables computers to learn from data"
|
| 21 |
}
|
| 22 |
]
|
|
|
examples/style_1.png
ADDED
|
examples/style_2.png
ADDED
|
examples/style_3.png
ADDED
|
examples/style_4.png
ADDED
|