Skip navigation

Phonebox

How KU Leuven brought AI insect detection from the lab to the field

Client
KU Leuven, MeBioS Division (Mechatronics, Biostatistics & Sensors)

Services
Web application, AI integration, cloud architecture, UX design

Sector
AgriTech / academic research

Timeline
Approximately five months with a part-time team

Tech stack
React 19, Supabase, Scaleway Serverless, Python ML pipeline, Tailwind CSS v4, TanStack Router

The challenge

The MeBioS team at KU Leuven had built something they were rightly proud of: an AI model that recognises and classifies insects on sticky traps in agricultural fields. It could identify fourteen species, including aphids, thrips, chicory leaf miners and cabbage flies. The science worked. The software around it needed attention.

Their existing tool was a Streamlit prototype running on AWS. It was good enough to produce results in the lab, but not ready for growers and research centres.

There were no roles or straightforward access controls, so everyone could see everything. It was difficult to use on a smartphone, even though growers needed it out in the field. AWS costs kept rising without the usage to justify them. Every change required manual intervention from technical staff.

MeBioS wanted agricultural businesses and growers across Flanders to have access to the technology. The AI model needed to leave the lab.

They came to us with a clear request: build a professional web application around their model.

Our approach

We spent the first few weeks working through the domain with Frank from MeBioS. How do sticky traps work? What exactly is a measurement? Which insects matter for which crops? How do research centres relate to agricultural businesses and individual growers?


The resulting domain model was surprisingly complex: businesses managing fields, fields linked to crops and target insects, measurements with several photos per trap, and a full AI processing pipeline behind them. Without that preparation, we would have had to start again halfway through.

From organisation to insect detection

Two layers: who manages the data, and what happens during a measurement?

Phonebox domain model: organisations manage businesses and fields; measurements connect trap photos to insect detections.

Separating the model from the infrastructure

We soon realised that the existing Python model could stay as it was. We needed to package it.

The MeBioS model worked. The code had been written for research and was not ready for production, but the detection itself was sound. The task was to let fifty users upload photos at once without anyone having to run a server.

Serverless containers on Scaleway were a good fit. The existing Python model runs unchanged in a Docker container. A Supabase edge function triggers the container when a user uploads photos. It downloads the photos from object storage, runs detection, uploads the results and sends progress updates back to the web app through callbacks. Detections enter the database with bounding boxes, confidence scores and a crop of each insect.

There are no servers for the team to manage. The pipeline scales with demand and stops when there is nothing to process. For a research institution, paying only for what it uses makes sense.

Three paths, one result in real time

Upload, processing and feedback run separately, without a dedicated application server.

Phonebox architecture: photo uploads trigger a serverless Python detection pipeline, with results and progress returned to the web app.

From lab tool to field app

We built the frontend as a client-side React application with Supabase as its backend. It needs no custom server. Deployment runs through Cloudflare Pages, and the architecture allows KU Leuven to host it on its own GitLab Pages in future.

The dashboard shows recent measurements and trends for each insect species, with warnings when thresholds are exceeded. Growers can upload photos from their phones in the field. After processing, the app displays bounding boxes and confidence scores on the photo. Researchers can verify or correct results through an annotation interface. Those validations can also help improve the model over time.

Research centres manage businesses and users, administrators manage their own teams, and growers see their own measurements and reports. Insect and crop names are available in Dutch, English and French. Everything can be exported to CSV or Excel for further analysis or publication.

Users sign in through magic links: an email code instead of a password. That keeps access straightforward for growers who do not work with software every day.

Large photos and honest estimates

Photos of sticky traps can exceed 100 megabytes. Generating thumbnails in the browser without freezing the user's machine took considerable work. We solved it with WebAssembly and canvas rendering.




A client-side-only architecture also added complexity around authentication and Row Level Security. The project took more hours than we had estimated, partly because of those technical surprises and partly because the summer brought a more relaxed working rhythm for both teams.




We reviewed that carefully within our team. The lessons: define the scope more precisely at the start and intervene sooner when work takes longer than expected.

The result

Phonebox is now in production and has fully replaced the Streamlit prototype.

Growers take photos in the field and view their results within minutes. Research centres have an overview of all their participating businesses and fields. When insect populations rise sharply, the system issues automatic warnings for each species. All data can be exported for publications or policy reports.

A serverless processing pipeline handles the work, with Row Level Security keeping each business's data separate. KU Leuven can host the application itself when it chooses.

The project is in its warranty period, with plans for a wider rollout across Flanders.

Related work

More case studies
S.Tool

An app to discuss bowel symptoms after cancer surgery

Patients complete the questionnaire in 30 seconds, giving researchers at KU Leuven and UZ Leuven longitudinal data.

Read the case
Maarallee

A lean citizen science app collecting Flemish speech

Volunteers record sentences and Scivil collects data to improve speech recognition, with a lightweight platform behind the scenes.

Read the case
FoodWIN

From spreadsheets and paper to real-time insight

The food waste reduction method worked, but the tools needed to catch up. The platform now supports everyday work in professional kitchens.

Read the case

Want to turn your research or AI model into a professional platform?

We would be happy to help.

Book a conversation

Talk directly with someone who can think through the details with you.

Not ready for a conversation? See what we have built