Giter Club home page Giter Club logo

intellifarma's Introduction

SMART FARMING

Table of Contents

Introduction

The project runs a Machine learning model to suggest the most suitable crop based on the soil parameters that the user inputs. Additionally, the model is trained using the Logistic Regression algorithm. The ML model is deployed via a mobile application built with Flutter and Flask.

Developer Manual (How to setup the system)

Installation

  1. Clone the repository:

    git clone https://github.com/mabuya02/intellifarma.git
  2. Navigate to the project directory:

    cd your-project
  3. Create and activate a virtual environment:

    python -m venv venv      # Create a virtual environment
    source venv/bin/activate  # Activate on Linux or macOS
     .\venv\Scripts\activate   # Activate on Windows
  4. Install dependencies:

    pip install -r requirements.txt
  5. Copy the .env.example to .env

    cp .env.example .env
    
  6. Run the secret.py file to generate the secrete key then copy and paste it to your environment file

    python3 secret.py
    

    Copy paste the secret key into you env file Certainly! Here's the information formatted into a README:


Database Configuration

Environment Variables

These variables are used to configure the database connection for your Flask application.

  • DB_HOST: Set the host address of your database server.
  • DB_USERNAME: Specify the username for database access.
  • DB_PASSWORD: Enter the password for the specified database user.
  • DB_NAME: Name of the database to be connected.

Flask-Migrate

Flask-Migrate is a Flask extension that handles SQLAlchemy database migrations. Once you have configured your database details in your environment variables or a configuration file, you can use Flask-Migrate to manage database changes, migrations, and updates.

To use Flask-Migrate:

  1. Initialize Migrations: Run the following command to initialize migrations in your Flask app:

    flask db init
    
  2. Generate a Migration: When you make changes to your database models, generate a migration script using:

    flask db migrate -m "Your migration message"
    
  3. Apply the Migration: Apply the generated migration script to update the database:

    flask db upgrade
    

Make sure to replace the placeholder values (DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME) with your actual database configuration.

Flask-Mail Setup

Flask-Mail is a Flask extension used for sending emails from your Flask application. To set up Flask-Mail in your project, configure the following parameters in your environment variables or configuration file:

Configuration Parameters

  • MAIL_SERVER: The SMTP server address for your email provider.
  • MAIL_PORT: The port number for the SMTP server (usually 587 for TLS).
  • MAIL_USERNAME: Your email address used for sending emails.
  • MAIL_PASSWORD: The password associated with your email account.
  • MAIL_USE_TLS: Set to True to enable TLS encryption.
  • MAIL_USE_SSL: Set to False to disable SSL.

Example Configuration (in .env file):

MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME="[email protected]"
MAIL_PASSWORD="your-email-password"
MAIL_USE_TLS=True
MAIL_USE_SSL=False

Usage in Flask Application:

To use Flask-Mail within your Flask application, instantiate the Mail object with your app:

Remember to replace '[email protected]'with your actual email credentials. You will obtain the email password from generating an your-email-password for the email you're using

Directory Structure

intellifarma/
│
├── app/
│   ├── __pycache__/
│   ├── __init__.py
│   ├── db_operations.py
│   ├── models.py
│   ├── routes.py
│   ├── services.py
│
├── migrations/
|
├── ml_model/
|   ├── smart_farmingmodel.py
│
├── venv/
│
├── .env
├── .env.example
├── .gitignore
├── config.py
├── LICENSE
├── README.md
├── requirements.txt
├── run.py
├── secret.py

Run the flask application

Run the following command tp start the flask server:

   flask run

Contributing

If you would like to contribute to the project, follow these steps:

  1. Fork the project.
  2. Create your feature branch: git checkout -b feature/your-feature.
  3. Commit your changes: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature/your-feature.
  5. Open a pull request.

License

This project is licensed under the GNU License file for details.

intellifarma's People

Contributors

mabuya02 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.