I always wanted a cat but never had one as a child. Decades later, I used Doubao API to merge my childhood photos with my cat's images, then built a reusable Django app (django-doubao) that does AI image fusion and image-to-video generation. Here's how it works and why I built it.
The Empty Space
When I was a kid, I longed for a cat. My mother wouldn't allow it. I pressed my face against the neighbour’s window, watching their tabby stretch and roll in the sun – a hollow ache in my chest.
Only after forty years did I finally get my own cat. But then a new sadness crept in: I couldn’t grow up with her.
So I devised a trick.
On Doubao (ByteDance’s AI platform), I took my old, faded childhood photos – gap-toothed, laughing – and merged them with my cat’s plump white face. Suddenly, we were playing together. Then I made videos: the child chasing the cat through a field of flowers, wind lifting our hair, years dissolving.
Each creation sent ripples through my heart – from a quiet centre to the corners of my lips and eyes.
A Programmer’s Solution
I started on Doubao’s official website, but soon I thought: I’m a programmer. Why not build my own app?
I got a Doubao API key, set up a Django project, and wrote a utils.py – not three hundred lines – that became the key to my own toy box.
My ritual:
- Pick a beautiful landscape – the old locust tree at my childhood hutong, summer thick with cicadas.
- Add my childhood face and my fat white cat (round as a snowball).
- Merge them into one image where we play together.
- Animate that still picture – the cat rolls on the grass, the child chases, flowers tremble in a breeze I only feel in memory.
I created two Django views:
- The first fuses multiple reference images into one AI-generated picture.
- The second turns that picture into a short video (5–12 seconds).
When I saw the boy and the cat move across the screen, something long empty inside me was gently filled.
I packed the whole thing into a Python package, django-doubao, and published it on GitHub.
What the Package Does
- Multi‑image fusion – combine several reference images + text prompt → one new AI image.
- Image‑to‑video generation – turn a single image (generated or uploaded) into a 5–12 sec video. Supports aspect ratios, resolutions, returns video + last frame.
-
Asynchronous polling – video generation is async; the package polls automatically. No
whileloops needed. - Task records – via Django models, so you can track or re‑create past generations.
Quick Architecture Overview
django-doubao/
├── doubao/
│ ├── models.py # ImageGeneration, VideoGeneration
│ ├── views.py # generate_image_view, generate_video_view
│ ├── urls.py # routes with namespace
│ ├── utils.py # API calls: generate_image, submit_video_task, poll_video_result
│ ├── templates/ # standalone Vue3 templates (no base.html required)
│ └── migrations/
├── tests/ # pytest + mock, 15 tests all green
├── pyproject.toml
└── README.md
Key decisions:
-
No built-in permissions – you wrap views with
login_requiredoruser_passes_testyourself. Each project is different. -
Self-contained templates – they work even if your project has no
base.html. You can override them. - Synchronous polling – good for low‑concurrency personal use; you can swap in Celery later.
Using django-doubao
Install:
pip install django-doubao
Add to INSTALLED_APPS:
INSTALLED_APPS = [
...
'doubao',
]
Set your API key:
DOUBAO_API_KEY = "your-key-here"
Include URLs:
# urls.py
path('doubao/', include('doubao.urls')),
Then visit /doubao/image/ to generate images, and /doubao/video/ to turn them into videos.
Why I’m Sharing This
I could have kept using online tools. But as a programmer, I chose to build a small world with code – one where the child and the cat can finally run, daydream, and watch maple leaves fall together.
If you have a similar wish – to revive an old photograph or animate a memory – I hope django-doubao helps you take fewer detours.
Code is like bricks. The important thing isn’t how complex it is, but what you build with it.
The cat is purring beside me. The video loops on the screen. I turn off the light, leaving only the screen’s glow – and that old hollow feels truly filled.
What do you think? Have you ever used AI to fill a childhood gap? Let me know in the comments.

Top comments (0)