A comprehensive Flutter application that provides AI-powered agricultural support and advisory services for farmers using Retrieval-Augmented Generation (RAG) technology.
- Text Search: Type your agricultural queries for instant answers
- Voice Search: Speak your questions in Hindi or English
- Image Search: Upload photos of crops, soil, or pests for AI analysis
- Personalized crop management recommendations
- Pest and disease identification and treatment
- Soil health analysis and improvement suggestions
- Fertilization and irrigation guidance
- Crop diseases database with symptoms and treatments
- Pest management strategies with integrated pest management (IPM)
- Soil management practices for different soil types
- Best practices for various crops and seasons
- External Dataset Integration with real-time data from:
- USDA (Crop yield and nutritional data)
- FAO (Global agricultural statistics and pest information)
- OpenWeather (Weather data for agricultural planning)
- SoilGrids (Global soil mapping and analysis)
- Agmarknet (Market prices and agricultural commodity data)
- Framework: Flutter 3.x with Material Design
- State Management: Provider
- Navigation: Built-in Navigator 2.0
- UI Components: Custom widgets with responsive design
- RAG System: Retrieval-Augmented Generation for enhanced search
- AI Integration: OpenAI GPT-3.5 Turbo API
- Speech Recognition: Speech-to-Text for voice queries
- Image Analysis: Computer vision for crop/soil analysis
- Local Storage: SQLite for offline functionality
- Datasets: Comprehensive agricultural knowledge bases
- Caching: Efficient data retrieval and storage
- Flutter SDK 3.0 or higher
- Android Studio or VS Code with Flutter extension
- Internet connection for API calls
-
Clone the repository:
git clone <repository-url> cd ai-based-farmer-query-app
-
Install dependencies:
flutter pub get
-
Configure API Keys: Create a
.envfile in the project root:OPENAI_API_KEY=your_openai_api_key_here -
Run the application:
flutter run
lib/
├── main.dart # Application entry point
├── models/ # Data models
│ ├── advisory_model.dart # Advisory system model
│ └── query_model.dart # Query system model
├── services/ # Business logic and API calls
│ ├── rag_service.dart # RAG system implementation
│ ├── ai_service.dart # AI integration service
│ ├── text_search_service.dart # Text search functionality
│ ├── voice_search_service.dart # Voice search functionality
│ └── image_search_service.dart # Image search functionality
├── ui/ # User interface components
│ ├── screens/ # Main application screens
│ │ ├── home_screen.dart # Main dashboard
│ │ ├── text_search_screen.dart # Text search interface
│ │ ├── voice_search_screen.dart # Voice search interface
│ │ ├── image_search_screen.dart # Image search interface
│ │ └── advisory_screen.dart # Advisory system interface
│ └── widgets/ # Reusable UI components
│ ├── search_option_card.dart # Search method cards
│ ├── search_result_item.dart # Search result display
│ ├── advisory_card.dart # Advisory item display
│ └── loading_indicator.dart # Loading animations
└── datasets/ # Agricultural knowledge bases
├── crop_diseases_dataset.dart # Crop disease information
├── pest_management_dataset.dart # Pest control strategies
└── soil_management_dataset.dart # Soil management practices
- Navigate to the Text Search screen
- Type your agricultural query in the search bar
- View relevant results from the knowledge base
- Get AI-generated responses for complex queries
- Go to the Voice Search screen
- Tap the microphone button to start recording
- Speak your query clearly
- The app will transcribe and search for relevant information
- View results and recommendations
- Access the Image Search screen
- Choose to upload from gallery or take a photo
- The AI will analyze the image for:
- Crop diseases
- Pest infestations
- Soil conditions
- General crop health
- Receive detailed analysis and recommendations
- Visit the Advisory screen
- Filter advisories by crop type and season
- View personalized recommendations
- Generate new advisories based on your specific needs
The application integrates with OpenAI's GPT-3.5 Turbo API for enhanced responses. To configure:
- Obtain an API key from OpenAI
- Add it to your
.envfile - The RAG system will use this for AI-generated responses
The application includes comprehensive datasets for:
- Crop diseases and their management
- Pest identification and control methods
- Soil types and management practices
These can be extended or modified in the datasets/ directory.
We welcome contributions to improve this application! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Offline functionality with local AI models
- Multi-language support beyond Hindi and English
- Weather integration for crop planning
- Market price information for crops
- Community forum for farmer discussions
- Integration with agricultural extension services
- Mobile app for agricultural experts
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in this repository
- Contact the development team
- Visit our documentation
- OpenAI for the GPT API
- Flutter community for excellent tools and libraries
- Agricultural experts who contributed to the knowledge base
- Farmers who inspired this project
Note: This application is designed to assist farmers with agricultural decisions. Always consult with local agricultural experts for region-specific advice.