How manvithlb/agridron works
Project type and purpose
• Agridron is a full-stack web application built with Flask to simplify agricultural operations via web interfaces, AI model inference, and possibly real-time webcam integration.
File structure
• Top-level files:
• app.py – main Flask application entry point
• model_inference.py – module encapsulating ML/AI logic (e.g., image analysis)
• webcam.py – module handling webcam capture and streaming
• requirements.txt, .gitignore, readme.md
• Directories:
• templates/ – Jinja2 HTML templates (index.html)
• static/ – client assets (CSS, JS, images)
– css/styles.css
– js/main.js, script.js
– img/ (any shipped images)
README for additional insights
• Uses Flask, requires environment variables (PORT, DEBUG, SECRET_KEY, OPENAI_API_KEY, API_KEY).
• Likely calls external services (OpenAI API) within model_inference.py or another component.
Main components and interactions
a. Frontend (Browser)
• HTML templates served by Flask
• Static assets (CSS, JS) for UI and event handling
• Webcam interface (invokes webcam.py endpoints or client-side capture)
b. Backend (Flask Application)
• app.py: defines HTTP routes (/, /inference, /webcam, etc.)
• model_inference.py: loads ML model, processes images/data, may call OpenAI API or other AI services
• webcam.py: endpoints to capture and stream webcam frames to server
• Environment & config loader (.env-flask) for API keys and debug settings
c. External services
• OpenAI API (for language/vision model calls)
• (Optional) Drone control API or agricultural data APIs if integrated
d. Persisted data
• No database in the repository; if future extensions include telemetry logs or user data, add a DB component (e.g., PostgreSQL).
Architectural patterns and design principles
• MVC-inspired separation:
• Model: model_inference.py
• View: templates + static assets
• Controller: app.py routes + webcam.py handlers
• Modularization:
• Separate AI logic from HTTP concerns
• Clear folder separation for static vs. dynamic content
• 12-factor-style config via environment variables
Final checklist
• Clear component labels (Browser, Flask Server, Model Inference, Webcam Handler, OpenAI API)
• Client vs. Server vs. External
• HTTP vs. internal function calls vs. API calls