AI / Image processing

Deep Dream: a Flutter app and a PyTorch queue behind it

A Flutter app sends a photo to a Python API. A Redis queue hands the job to a PyTorch worker that runs DeepDream on a convolutional neural network, and the dreamed image comes back to save to the gallery.

Our role: Our own R&D and Simon Dziak's first AI build. Two other developers contributed: one commit to the app repository and four of the five commits in the API repository. It was never released to an app store.

The Problem

What Deep Dream Needed to Solve

DeepDream turns a photo into something surreal by running gradient ascent on a neural network until it amplifies whatever patterns it finds. It is heavy: one image takes many forward and backward passes at several sizes, which is work for a background job rather than an HTTP request. The experiment was to see what it takes to put that behind a mobile app: a client that uploads, a server that queues, and a worker that does the slow part.

The Build

How We Built It

Two repositories. The Flutter app picks a photo, converts HEIC images to JPEG, lets the user choose a style and posts the file as multipart form data. The API is a Flask app with a shared-token check. It saves the upload, puts a job on a Redis queue through RQ and returns a job id. A separate worker process runs the job with a 30-minute timeout and returns the finished image as base64. A client can ask the API for the job status: queued, started, finished or failed.

Features

What the Product Does

Photo upload

Pick a photo from the gallery, convert HEIC to JPEG and upload it.

Style choice

The app has seven named styles to choose from. The server side takes the model, the layers and the strength settings as a JSON config.

Job queue

POST /process returns a job id at once. GET /output/<job> answers 203 while queued, 202 while running, 200 with the image when finished and 400 on failure.

Save to gallery

The finished image is decoded and saved to the phone's gallery.

Tunable DeepDream

Image pyramid size and ratio, number of gradient-ascent iterations, learning rate, spatial shift, gradient smoothing, layers to amplify and the model are all configurable per job.

Architecture

The Stack, Layer by Layer

Client app
Flutter and Dart with image_picker, heic_to_jpg, image_gallery_saver and http. About six Dart files.
API
Flask with CORS, token-checked endpoints and an upload folder. Config values are filled with defaults before the model runs.
Queue and worker
Redis with RQ. The API only enqueues, and a separate worker process does the work, so a long job never blocks a request.
Model code
PyTorch and OpenCV. The DeepDream code follows the open-source gordicaleksa/pytorch-deepdream project, which the notebook in the repository credits. It supports five model options built on four network families (VGG, GoogLeNet, ResNet, AlexNet) and two pretrained weight sets (ImageNet and Places365).
Video mode
An "ouroboros" mode feeds each dreamed frame back in with a zoom, a zoom with rotation, or a translation, then assembles the frames into a video with ffmpeg.
By the Numbers

Verifiable Facts

Jun 2021
First commit to the Flutter app repository
Oct 2021
API repository: five commits between October 18 and 24
5
Model options across 4 network families
2
Pretrained weight sets: ImageNet and Places365
3
Frame transforms for the video mode

Counted from the private source repositories on October 13, 2026. This was an R&D build. It was not released to an app store, and this page makes no claims about users.

Lessons

What We Learned Shipping It

Put slow work behind a queue

The worker allows a job up to 30 minutes. Returning a job id immediately and polling for the result keeps the request short and lets a separate worker carry the load. The status codes (203, 202, 200, 400) let a client show real progress.

Build on existing research code, and say so

The DeepDream core is not original to this project. We adapted a public PyTorch implementation, kept its credit in the notebook, and spent our time on the part that was new: the API, the queue and the app.

Prototype each layer on its own, then join them

The app (June 2021) and the API (October 2021) were built as separate prototypes four months apart. The app calls /deep/dream/<style> and the API serves /process and /output/<job>, so the first step to a release is a shared contract. The queue, the worker and the client each work on their own.

Video mode is built and ready to expose

The ouroboros video mode already runs in the DeepDream module. Adding it to the API means one more queue task alongside the single-image path.

A shared token is a prototype

The API checks one static token from a request header. That was enough to keep a demo private. It is not an auth system, and a real release would need per-user sign-in and per-user limits.

Technologies Used
Flutter•Dart•Python•PyTorch•Flask•Redis•RQ•OpenCV
Timeline
June 2021 (Flutter app) and October 2021 (API and model code)

Planning Something Similar?

We build Flutter and Firebase apps for startups and small businesses. Get a ballpark with our app cost calculator, see Flutter development, or tell us about your project.

More Case Studies

SaaS / Business software

Workspace369: a Flutter and Firebase SaaS for client work

An all-in-one workspace for freelancers and small service businesses: CRM, proposals, invoicing and payments, scheduling, a shared email/SMS/voice inbox, accounting and AI, in one Flutter app on iOS and the web.

Read Case Study →
Consumer / Music

3693: a private music app in Flutter and Firebase

A private music app built with Flutter: search, a now-playing screen with lyrics, a queue, playlists, liked songs, a cloud library, listening stats and light and dark themes, on a typed Firebase backend.

Read Case Study →
Consumer / Collectibles

DG Card: scan a trading card and match it on the device

A Flutter app for trading card players. Point the camera at a card, on-device text recognition reads it, and the app matches it against a synced card database. From there you track a collection, build decks and trade with other players.

Read Case Study →
Automotive / Security hardware

Bull Horn GPS Alarm: one-tap SMS commands for an alarm

A Flutter app that works as a remote control for GPS vehicle and asset alarms. Each alarm is saved once with its phone number and password, and every command after that is one tap.

Read Case Study →
Landscaping / Field sales

Artificial Grass Masters: a field estimator and job sign-off app

A Flutter app for an artificial-turf installer. A rep measures a yard on a map, prices the grass, delivery and dumpster on the spot, and closes the job with photos, a customer signature and a rating. The company gets a text message when a new rating comes in.

Read Case Study →
AI integration / Open source

saas-mcp-connector: a safe MCP server for a SaaS API

An MCP server that lets Claude Desktop, Claude Code and other MCP clients use a SaaS product's API safely. Every call is scoped to one user's workspace, writes need explicit confirmation, and the HTTP transport is rate limited.

Read Case Study →