How ugeshraja/smart-farming-ai works
SmartFarm AI serves farmers through a React application and FastAPI gateway. Its main flows are crop-image diagnosis (localize, segment, classify, explain, then advise), text/voice agronomic assistance, and weather-informed planning. The repository also documents field evaluation, community, library, and government-scheme capabilities. Edges reflect shown imports/calls or README-documented flows; several feature implementations were not sampled, so their internal links are omitted or marked unverified.
Main entry points: App.jsx Web app and routes · main.py FastAPI gateway · apiService.js API client · AuthContext.jsx Authentication state
Components 27
Farmer application
- Web app and routes
src/App.jsx - Authentication state
src/context/AuthContext.jsx - Weather context
src/context/WeatherContext.jsx - Disease detection
src/pages/DiseaseDetection.jsx - Farmer assistant
src/pages/FarmerAssistant.jsx - Planner and field
src/pages/Planner.jsx - Community, library, schemes
src/pages - API client
src/services/apiService.js - Weather service
src/services/weatherService.js
API gateway
- FastAPI gateway
backend/main.py - Prediction route
backend/routes/predict.py - Chat route
backend/routes/chat.py - Voice route
backend/routes/voice.py - Weather route
backend/routes/weather.py - Other API routes
backend/routes
Agricultural intelligence
- Vision and explainability pipeline
backend/services/ai_pipeline_service.py - Agricultural knowledge retrieval
backend/services/rag_service.py - Field suitability evaluator
src/services/fieldEvaluator.js - Scheme and library services
backend/services
Accounts and data
- Authentication service
backend/services/supabase_auth_service.py - Database sessions
backend/database/session.py - Database connection
backend/database/connection.py
External services
- Supabase Auth and database
- Gemini language model
- OpenWeather
- Speech and TTS services
backend/services/tts_service.py
Other components
- Farmer
Connections 34
- Farmer → Web app and routes: uses
README.md - Web app and routes → Disease detection: routes to
src/App.jsx - Web app and routes → Farmer assistant: routes to
src/App.jsx - Web app and routes → Planner and field: routes to
src/App.jsx - Web app and routes → Community, library, schemes: routes to
src/App.jsx - Web app and routes → Authentication state: provides state
src/App.jsx - Web app and routes → Weather context: provides state
src/App.jsx - Disease detection → API client: requests diagnosis
- Farmer assistant → API client: sends queries
- Planner and field → API client: requests data
src/pages/Planner.jsx - API client → FastAPI gateway: calls API
- Weather context → Weather service: uses
src/context/WeatherContext.jsx - API client → Weather service: fetches weather
src/services/apiService.js - Weather service → OpenWeather: requests forecasts
src/services/weatherService.js - FastAPI gateway → Prediction route: registers
backend/main.py - FastAPI gateway → Chat route: registers
backend/main.py - FastAPI gateway → Voice route: registers
backend/main.py - FastAPI gateway → Weather route: registers
backend/main.py - FastAPI gateway → Other API routes: registers
backend/main.py - Prediction route → Vision and explainability pipeline: invokes
- Vision and explainability pipeline → Agricultural knowledge retrieval: retrieves context
backend/services/ai_pipeline_service.py - Chat route → Agricultural knowledge retrieval: retrieves context
backend/routes/chat.py - Chat route → Gemini language model: generates advice
- Vision and explainability pipeline → Gemini language model: generates advisory
- Weather route → OpenWeather: fetches weather
- Voice route → Speech and TTS services: handles speech
- Authentication state → Supabase Auth and database: authenticates
- Authentication state → Field suitability evaluator: evaluates field
src/context/AuthContext.jsx - Other API routes → Authentication service: uses identity service
backend/routes/auth.py - Authentication service → Database connection: queries database
backend/services/supabase_auth_service.py - Database sessions → Database connection: gets engine
backend/database/session.py - Authentication service → Supabase Auth and database: verifies and persists users
backend/services/supabase_auth_service.py - Community, library, schemes → Scheme and library services: presents resources
- Planner and field → Field suitability evaluator: evaluates suitability