(made for Fusion / Bornhack 2025)
Bornhackers: Check out http://151.216.66.159:8000/docs
Takes automated selfies, generates more pictures from that, and plays a bouncing gif.
sdxl-turbo_online-mode.mov





Using:
- Automated Selfies: Yolov8 trained by arnabdhar
- Offline image generation: Neural Style Transfer deepeshdm
- Online image generation: Stable Diffusion XL Turbo in repo sdxlturbo-api
See all arguments:
- with uv
uv run selfusion.py --help
- standard
python selfusion.py --help
Most interesting settings you will find in selfusion_utils.args
, such as:
- gif delay
- waiting time
- loading bar time
- come closer screen or not
- face size threshold
- yolo settings (confidence, IoU)
- diffuser settings (strength, inference steps, prompt ...)
Another bit that's might be fun: Adding more style pictures — they are picked randomly.
You can find them in neural_style_transfer.style_images
.
- Raspberry Pi 5 (16GB)
It's meant to work with sdxlturbo-api hosted on some machine (runs well with mps on my Mac or cuda on a cloud VM with GPU - if you want you can test just the sdxlturbo code straight on Colab with T4, was super easy).
Anyway, it still has offline functionality. If it cannot get results from the Stable diffusion API, it generates pictures with neural style transfer on the local machine / the pi.
sudo apt-get install libgtk2.0-dev pkg-config
The raspberry had python 3.11
preinstalled
pip install -r requirements.txt
Gets it running.
Or even better if you use uv, run in the directory of this repo:
uv venv --python 3.11
uv pip install -r requirements.txt
Note:
Some of the code in this repo was used for experimentation (such as the stable-diffusion
folder or yolo_onnx_openvino.py
, they need more dependencies, so most directories have their own requirements files)
-
with uv
uv run selfusion.py
-
standard
python selfusion.py
I run it as systemd service:
[Unit]
Description=Fusion Raspberry Process
After=graphical-session.target
[Service]
Type=simple
WorkingDirectory=/home/pi/src/raspberry-pi
ExecStart=/home/pi/src/selfusion_venv/bin/python /home/pi/src/selfusion/selfusion.py
Restart=on-failure
RestartSec=5
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
[Install]
WantedBy=default.target
that file goes under:
~/.config/systemd/user/fusion.service
run service
systemctl --user daemon-reload
systemctl --user enable fusion.service
systemctl --user start fusion.service
This project is licensed under AGPL v3+