Skip to content

Ujjal57/AgriAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌾 AgriAI – AI-Powered Contract Farming Platform

AgriAI is an AI-powered contract farming platform that digitally connects farmers and buyers through a secure and transparent system. The platform enables farmers to upload crop details and buyers to post procurement deals, allowing both parties to search, negotiate, and finalize contracts through mutual agreement.

⚠️ Note on Source Code

πŸ”’ Disclaimer: he full implementation of some parts of the project, including advanced recommendation features, payment gateway integration, or proprietary logic, has been intentionally omitted from the public repository to protect sensitive code and data.

πŸ‘₯ User Roles

  • Farmer
  • Buyer Each user role has secure authentication and role-based access.

🧹 Data Handling & Processing

  • Structured data storage using MySQL
  • Separate tables for users, crops, deals, carts, and contracts
  • Secure CRUD operations through Flask APIs
  • Input validation and role-based access control

πŸš€ Key Features

  • πŸ” Farmer & Buyer Authentication – Secure login and registration
  • 🌱 Crop Upload – Farmers can list crops with price, quantity, and availability
  • πŸ“„ Deal Posting – Buyers can upload purchase requirements
  • πŸ”Ž Two-Way Search – Farmers can search buyers and buyers can search farmers
  • πŸ›’ Cart-Based Workflow – Crops or deals added to cart for contract initiation
  • πŸ“ Digital Contract System – Contracts generated after mutual approval
  • πŸ€– AI Chatbot – Answers farming-related queries and platform guidance
  • 🌐 Multilingual Support – English, Hindi, and Kannada

🚫 Deployment Status

  • Project is currently not deployed online
  • Can be executed locally using Flask backend and web-based frontend

🎯 Impact

  • Enables direct farmer-to-buyer interaction
  • Reduces dependency on intermediaries
  • Promotes transparent and secure contract farming
  • Demonstrates real-world integration of AI, web technologies, and databases
  • Strong showcase of AgriTech-focused full stack development

πŸ“‚ Project Structure

πŸ“ AgriAI
β”‚
β”œβ”€β”€ backend/                 # Flask backend
β”‚   β”œβ”€β”€ app.py               # Main Flask app
β”‚   β”œβ”€β”€ create_tables.sql    # SQL scripts to create tables
β”‚   β”œβ”€β”€ .env                 # Environment variables
β”‚   β”œβ”€β”€ routes/              # API route files
β”‚   β”œβ”€β”€ utils/               # Helper functions, validations
β”‚
β”œβ”€β”€ src/                     # React.js frontend
β”‚   β”œβ”€β”€ components/          # Reusable components
β”‚   β”œβ”€β”€ farmer/              # Farmer-specific pages
β”‚   β”œβ”€β”€ buyer/               # Buyer-specific pages
β”‚   β”œβ”€β”€ Cart.js
β”‚   β”œβ”€β”€ Navbar.js
β”‚   └── i18n.js              # Multilingual support
β”‚
β”œβ”€β”€ README.md                # Project documentation
└── package.json             # Frontend dependencies



βš™οΈ Installation & Running Locally

πŸ”Ή Prerequisites

πŸ”Ή 1. Clone the repository

git clone https://github.com/Ujjal57/AgriAI.git
cd AgriAI

πŸ”Ή 2. Backend Setup (Python/Flask)

# Navigate to backend directory
cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
# source venv/bin/activate

# Install Python dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env.example .env
# Edit .env file with your database credentials:
# DB_HOST=localhost
# DB_USER=your_mysql_username
# DB_PASSWORD=your_mysql_password
# DB_NAME=agri_ai
# DB_PORT=3306

# Initialize database tables
python init_database.py

πŸ”Ή 3. Database Setup (MySQL)

-- Create database
CREATE DATABASE agri_ai;

-- The application will automatically create required tables
-- when you run init_database.py

πŸ”Ή 4. Frontend Setup (React)

# Return to root directory
cd ..

# Install Node.js dependencies
npm install

# Start the React development server
npm start

πŸ”Ή 5. Run the Application

Terminal 1: Start Backend Server

cd backend
python app.py

Terminal 2: Start Frontend Server

npm start

πŸ”Ή 6. Access the Application

πŸ”Ή Troubleshooting

  • Port conflicts: If ports 3000 or 5000 are busy, React/Flask will prompt for alternative ports
  • Database connection: Ensure MySQL is running and credentials in .env are correct
  • Python virtual environment: Always activate the virtual environment before running backend commands
  • Dependencies: If you encounter import errors, ensure all packages from requirements.txt are installed

πŸ”Ή Optional Features

To enable additional features, uncomment the relevant packages in backend/requirements.txt:

  • AI/ML Features: Uncomment groq, mediapipe, scikit-learn, opencv
  • Translation: Uncomment deep-translator, langdetect, gTTS
  • Admin Dashboard: Uncomment streamlit
  • PDF Processing: Uncomment PyMuPDF
  • Document Processing: Uncomment python-docx

### πŸ”Ή 4. Frontend setup

- Navigate to src/ and install dependencies:

```npm install
npm start

πŸ”Ή 4. Run backend


πŸ–ΌοΈ Screenshots

Home Page
Home Page

Sign In/Sign Up
Sign In/Sign Up

Farmer Page
Farmer Page

Buyer Page
Buyert Page

Crops Page
Crops Page

Deals Page
Deals Page

Cart Page
Cart Page


πŸ” Sample Admin/Farmer/Buyer Access

  • Credentials can be created through registration pages

πŸ‘¨β€πŸ’» Developer

Ujjal Kumar Dey

About

AI-powered agriculture marketplace platform connecting farmers and buyers through a digital marketplace with crop listings, deals management, and smart agricultural workflows using modern web technologies.

Topics

Resources

Stars

Watchers

Forks

Contributors