I created this linear regression model with a mission to help people in the field of agriculture get accurate information about history of crop yield for making decisions related to agricultural risk management and future predictions. Crops yield production value in hectogram per hectare (Hg/Ha) is got in a certain year according to the crop, weather conditions(Average rain fall per year,temperature) and Pesticides used in tonnes.
To train the model I first choosed a dataset containing historical agricultural data and processed it to get the best model with low loss metric which I saved to it for prediction
###Description of dataset The dataset used contains agricultural yield data across various regions, crops, and years. It includes key factors such as rainfall, temperature, and pesticide usage, aiming to analyze their impact on crop yields. Source of dataset: Kaggle
This repository also contains a FastAPI-based RESTful API for predicting crop yields based on various inputs like crop type, year, rainfall, pesticide usage, and average temperature. This API is powered by a machine learning model (best_model_cropyield.joblib) trained before to predict crop yield (in hectograms per hectare) with high accuracy.
To help users predict the crop yield I created mobile app using flutter to help them get predictions in a better and a user friendly way and also to help them access the cropyield information through their mobile phone in an easy way.
- Predict crop yields for multiple crop types.
- Input validation using Pydantic.
- Asynchronous prediction using FastAPI and a thread pool executor.
- CORS support for cross-origin requests.
- clone the repository by using the command
git clone https://github.com/lilika67/linear_regression_model.git
- navigate to project directory by
cd linear_regression_model
- Install all required packages by
pip install -r requirements.txt
- run the api by
uvicorn summative.cropyieldApi.prediction:app
To run this fastApi you can use the swagger docs through the link https://linear-regression-model-66rf.onrender.com/docs
- clone the repo using the command
git clone https://github.com/lilika67/linear_regression_model.git
- navigate to project directory by
cd flutterApp
- install all required dependencies by
flutter pub get
- launch emulator by
flutter run
LINK TO YOUTUBE VIDEO
FlutterApp UI
Screen before making prediction
Screen After making prediction