How homanmirgolbabaee/evogem works
Project type and purpose
• This is an IoT-enabled, full-stack Python application with a web-based UI (Streamlit) that integrates Google’s Gemini Pro Vision API for image/video analysis and pushes results to a NodeMCU ESP8266 microcontroller driving an OLED display.
File structure
• Top-level files:
• main.py – Streamlit application entrypoint and orchestration layer
• cam.py – Python module encapsulating image/video capture and API calls to Gemini Pro Vision
• requirements.txt – Python dependencies (e.g., streamlit, google-api-client)
• sketch_feb24a.ino & sketch_jan11b.ino – Arduino sketches for the NodeMCU/ESP8266 to receive data and render on an OLED
• README.md & LICENSE – documentation and license
README for additional insights
• Confirms:
• Streamlit UI guides user interaction
• Python code calls Gemini Pro Vision via secure secrets
• NodeMCU acts as an “edge” display device
Main architectural components
a. Frontend (User Interface)
– Streamlit running in a browser or local host
– Accepts user input (images/videos) and displays results returned by backend
b. Backend (Application Logic)
– main.py orchestrates workflow:
• Receives uploads/commands from Streamlit
• Delegates to cam.py for API communication
– cam.py handles:
• Packing images/videos
• Authenticating and calling Gemini Pro Vision
• Returning analysis results
c. External Service
– Google Gemini Pro Vision API (multi-modal model endpoint)
d. Edge Device (IoT)
– NodeMCU ESP8266 running Arduino sketch
– Connects via Wi-Fi (e.g., HTTP, WebSockets, or MQTT) to receive JSON or text commands
– Drives the OLED display to show results
e. Configuration & Secrets
– Streamlit’s secrets management (e.g., .streamlit/secrets.toml) to store API keys
Relationships & data flow
1) User uploads image/video via Streamlit UI
2) main.py calls cam.py → cam.py formats and sends request to Gemini Pro Vision → receives analysis
3) main.py updates Streamlit UI with results
4) main.py also sends the same result over network (HTTP request or MQTT publish) to NodeMCU
5) NodeMCU Arduino sketch parses incoming data and updates OLED display
Architectural patterns & design principles
• Layered architecture: UI layer → Application/service layer → Device layer
• Single responsibility: cam.py isolates API integration; main.py handles orchestration & UI glue
• Edge computing pattern: lightweight microcontroller for real-time display, heavy lifting offloaded to cloud
• Secure secret management for credentials
Final checklist
• [ ] Clear labels on all components: Streamlit UI, main.py, cam.py, Gemini Pro Vision, NodeMCU + OLED
• [ ] Optional: include versioned sketches if there are multiple hardware revisions