SmartFarm AI: Crop Disease Detection, Yield Prediction and Farmer Community, a Python Final Year Project with Source Code
Back to ProjectThis takes about 15 to 20 minutes, and most of that is TensorFlow downloading. Keep your internet on and don't close the terminal halfway through.
Get the project folder. Unzip SmartFarm-AI somewhere simple, like D:\Projects\SmartFarm-AI. Avoid folders with spaces or very long paths. Then open a terminal inside that folder (in VS Code: Terminal, then New Terminal).
Check your Python version. Run python --version. You want to see 3.10.x. If it shows something else and you have several Pythons installed, use py -3.10 in the next step on Windows.
Create a virtual environment. This keeps the project's packages separate from everything else on your laptop.
python -m venv venv
Activate it.
Windows: .\venv\Scripts\activate
macOS/Linux: source venv/bin/activate
You'll see (venv) at the start of the terminal line. If you don't see it, the next step will install everything in the wrong place.
Upgrade pip, then install dependencies.
python -m pip install --upgrade pip
pip install -r requirements.txt
This pulls in Flask 2.3.3, scikit-learn 1.3.0, TensorFlow, OpenCV, Pillow and the rest. TensorFlow is big, so let it finish.
Check the models folder. Open models/ and confirm these files are there: yield_prediction_model.pkl, disease_prediction_model.pkl, weather_model.pkl, fertilizer_recommender.pkl, leaf_disease_model.h5, crop_cnn_model.keras, the scaler and encoder .pkl files, and labels.json. You don't need to train anything. Skip the notebooks for now.
Run the app.
python app.py
On the first run, database.py creates smartfarm.db automatically. No database setup needed.
Open it in your browser. Go to http://127.0.0.1:5000/.
"No matching distribution found for tensorflow" or the .keras model fails to load: This is almost always the Python version. Delete the venv folder, recreate it with Python 3.10, and run the install again.
"Address already in use" on port 5000: Something else is using that port. On macOS it's often AirPlay Receiver, which you can turn off in System Settings. Or change the port at the bottom of app.py to app.run(debug=True, port=5001) and open http://127.0.0.1:5001/ instead.
"ModuleNotFoundError: No module named cv2": Your venv probably wasn't active when you installed. Activate it and run pip install opencv-python.
admin@smartfarmai.com / admin123. The admin dashboard should show platform stats.If all five work, you're done. Change the admin password before you demo it to anyone.
Our team is here to assist you with installation and setup.