The Agri-Tech Builder

Coding smart solutions for off-grid farming

Project Log: Building a Leaf-Scanning App for Crop Health

Published: May 17, 2026

Welcome to my first project log! Today, I am documenting the development of a computer vision application designed to detect plant health and optimize agricultural output.

The Problem

Monitoring crop health manually takes immense time and effort. I needed a technological solution to quickly identify if plants are thriving or if they require immediate intervention, such as adjusting fertilizer or water.

The Tech Stack Pivot: Why I Ditched TensorFlow

When I first started this project, I attempted to build a custom image classification model using TensorFlow. While powerful, I quickly realized that as a solo developer, training a custom model is incredibly time-consuming. It required a massive, perfectly labeled dataset and constant tuning just to handle basic variations in lighting and angles.

To solve this, I pivoted the "brain" of the app to Azure OpenAI using the GPT-4o model. Instead of training my own model from scratch, I am utilizing GPT-4o's advanced multimodal vision capabilities to analyze the leaf images. This shift saved hundreds of hours of development time and drastically improved the accuracy of the disease detection.

The Architecture: Securely Connecting to Azure

A major challenge was figuring out how to connect the frontend mobile app to Azure OpenAI without exposing my private API keys. If I put the keys directly in the JavaScript frontend, they could be compromised.

The solution? Supabase Edge Functions. Instead of the app talking directly to Azure, the frontend sends the captured image to a secure Supabase backend URL. Supabase holds the secret keys, processes the request to GPT-4o, and sends the diagnosis back to the user. It acts as a seamless, highly secure bridge.

Next Steps: The Freemium Wallet

With the scanner working securely, my next hurdle is implementing a freemium wallet system using local storage to offer users a set amount of free scans before prompting a paywall. I will document that logic in my next update!