Chat-bot

AI Farmer Assistant

A student project using Python Flask, HTML, CSS, JavaScript, SQLite and the OpenAI API.

Features

Requirements

Python 3.10+, internet access, an OpenAI API key with API access, and a modern browser.

Windows setup

  1. Extract the ZIP and open the folder in VS Code.
  2. Open a terminal in the project folder.
  3. Run py -m venv .venv
  4. Activate: .venv\Scripts\Activate.ps1
  5. Install: pip install -r requirements.txt
  6. Copy .env.example to .env.
  7. Put your API key in .env as OPENAI_API_KEY=your_real_key. Never share this file.
  8. Run python app.py.
  9. Open http://127.0.0.1:5000.

macOS/Linux

Run python3 -m venv .venv, source .venv/bin/activate, pip install -r requirements.txt, copy .env.example to .env, add your API key, then python app.py. Open http://127.0.0.1:5000.

Test prompts

Safety and deployment

The API key stays on the Flask server. Chat data is stored locally in farmer_chat.db. Voice input depends on browser speech recognition support and microphone permission. This is an educational prototype, not a substitute for a soil test or qualified local agronomist. Confirm chemical use with product labels and local agricultural experts. Before public deployment, add authentication, CSRF protection, rate limiting, HTTPS, privacy notice and production hosting; disable Flask debug mode.