
Upload a leaf photo and the app names the disease. Enter rainfall and temperature and it predicts yield. It’s a Flask and TensorFlow AI final year project with 7 ML/DL models, a farmer forum and a marketplace already built in.
Python | Flask | TensorFlow | Keras | scikit-learn | OpenCV | SQLite | Bootstrap 5 | Chart.js
SmartFarm AI is a Flask web application that gives farmers AI-backed advice on what to grow, how much they'll harvest, which fertilizer to use and what's wrong with a sick plant. It runs five classic machine learning models (Random Forest and Linear Regression, built with scikit-learn) and two deep learning image models: a VGG16 CNN that detects 33 leaf diseases across 9 plant species, and a MobileNetV2 CNN that classifies 30 crop types from a photo. Around the models there's a full community layer with a discussion forum, a buy/sell marketplace, expert advice and local farmer connections. It also has role-based dashboards for Admin, Farmer and User.
Most agriculture projects you'll find online do one thing. This one does nine.
Picture a farmer in Karnataka with a tomato plant whose leaves are going yellow-brown at the edges. They open SmartFarm AI, upload a photo of the leaf, and a few seconds later the app tells them it's likely early blight. It shows how confident it is, lists the next two most likely diagnoses, and suggests a treatment. That's the image side.
The data side covers planning. Enter your soil type, pH, season, water availability and market preference, and the crop recommender ranks crops by suitability score, expected yield and profit margin. Enter rainfall, pesticide usage and temperature, and the yield model estimates output in hg/ha. The fertilizer advisor gives NPK dosages based on crop, soil, growth stage and field size, and adds an application schedule and a rough cost.
Every prediction gets saved to the user's history. So when your guide asks "where does the data go?", you can open the dashboard and show them.
yield_prediction_model.pkl) predicts yield in hg/ha from rainfall, pesticide and temperature inputs. Inputs are normalized through yield_scaler.pkl before inference.leaf_disease_model.h5) covers Apple, Cherry, Corn, Grape, Peach, Pepper, Potato, Strawberry and Tomato, with 33 conditions in total. You get the confidence score, the top predictions and treatment advice.crop_cnn_model.keras) identifies 30 crops from a photo, including Rice, Wheat, Cotton, Sugarcane, Tea, Coffee, Jowar and Pearl Millet. These are the crops Indian examiners actually recognise.Backend is Flask 2.3.3 with SQLite. The ML side uses scikit-learn 1.3.0. Deep learning runs on TensorFlow/Keras, with OpenCV and Pillow handling image preprocessing. The frontend is Bootstrap 5, Font Awesome 6 and the Inter font, with Chart.js for graphs in the browser. Training visualizations were made with matplotlib and seaborn inside the notebooks. There are 19 Jinja2 templates and 11 REST-style API endpoints, such as /api/detect-plant-disease and /api/recommend-crop.
This part gets skipped a lot, and it matters. You don't only get .pkl and .h5 files you can't explain. You get the notebooks that produced them: training.ipynb for the yield, disease-risk and weather models, crop_classification_training.ipynb for the MobileNetV2 model, and PlantDiseas.ipynb for the VGG16 leaf model. When the external examiner asks "how did you train this?", open the notebook and walk them through it.
Four tables, all in SQLite:
users stores accounts with role and profile infopredictions_history stores each prediction with its type, input JSON and result, linked to the userforum_posts stores questions with category and crop tagsmarketplace_listings stores buy/sell listings with item details and locationThe database creates itself on first run through database.py, so there's no MySQL setup to fight with.
Here's the thing: the hard bit isn't the code, it's TensorFlow. Get the Python version wrong and TensorFlow either refuses to install or loads the .keras model with a confusing error. Stick to Python 3.10 and you'll skip most of that pain. The installation guide below covers it.
But the part that's easier than it looks is the model training. You don't need a GPU or three days of compute. Pre-trained models are already in the models/ folder, so python app.py works on a normal college laptop. Retraining is optional, mostly useful if your guide wants you to show the process live.
If you're a student who needs a working project for your college submission, final-year project, semester project, internship, or academic demonstration, this is for you. Whether you're studying BCA, B.Tech, MCA, M.Tech, Computer Science, IT, AI, Data Science, or another related field, you can choose a project that fits your requirements. If you need the source code, project report, documentation, or help setting up and running the project, CodeAj gives you the resources and support to get started faster.
It especially suits you if your college wants a "socially relevant" topic. Agriculture lands well with Indian panels every time, and it's hard to call this a toy project when it combines classic ML, CNNs and a full user system.
You don't just download a zip and pray. You get the complete source code, the trained models, the training notebooks and a project report you can adapt to your college format. If something breaks on your machine, whether it's a TensorFlow install error, a missing package or a model that won't load, our team helps you get it running over a setup call. Plenty of students have presented projects like this one; a few of their stories are on our success stories page.
If you like the Flask side of things, browse our other Flask projects with source code. Want more image-based AI? The computer vision projects section has a few that pair well with this one. And if you're still choosing a topic, start with the full list of AI and ML final year projects.
Add any of these professional upgrades to save time and impress your evaluators.
We'll install and configure the project on your PC via remote session (Google Meet, Zoom, or AnyDesk).
1-hour live session to explain logic, flow, database design, and key features.
Want to know exactly how the setup works? Review our detailed step-by-step process before scheduling your session.
Fully customized to match your college format, guidelines, and submission standards.
Need feature changes, UI updates, or new features added?
Charges vary based on complexity.
We'll review your request and provide a clear quote before starting work.
Reviews