How decalnguyen/htnkgda works
Project Type and Purpose
• Full-stack web application
• Front end serves a static HTML/CSS/JS UI
• Back end (Python) hosts an API, loads a PyTorch model (my_model.pt), and returns inference results
• Docker Compose orchestrates the two containers
File Structure
Top-level:
• docker-compose.yml → orchestration of Frontend and Backend services
• Backend/
• Dockerfile → builds the Python service image
• main.py → application entrypoint, defines API endpoints
• my_model.pt → pre-trained ML model loaded at runtime
• requirements.txt → Python dependencies
• Frontend/
• Dockerfile → builds the static-site container
• HTML, CSS, JS folders → static assets served to the browser
• env.js → front-end configuration (e.g., API base URL)
• mykeypair.pem → certificate or SSH key, likely for secure comms or deployment
Extract Additional Insights from README
• Currently minimal; assume standard ML inference API use case
Main Components & Their Interactions
a. Components:
1) User’s Web Browser (Client)
2) Frontend Container
– Serves HTML/CSS/JS
– Contains env.js with API endpoint configuration
3) Backend Container
– Flask/FastAPI (or similar) server in main.py
– Loads my_model.pt on startup
4) Docker Compose
– Defines and links both containers on a private network
5) Optional: TLS termination or SSH gateway (mykeypair.pem)
b. Interactions / Data Flow:
1) User → HTTP GET → Frontend Container → index.html, CSS, JS
2) Frontend JS → HTTP POST/GET → Backend API (predict endpoint)
3) Backend loads model → runs inference → returns JSON response
4) Frontend JS receives JSON → updates UI
c. Architectural Patterns & Principles:
– Two-tier (client and server) architecture
– Containerization for isolation and reproducible environments
– Separation of concerns: static assets vs. application logic vs. model artifact
d. Key Technologies & Frameworks:
– Docker & Docker Compose
– Python web framework (Flask/FastAPI)
– PyTorch inference (my_model.pt)
– Vanilla HTML/CSS/JS (no SPA framework indicated)
Putting It All Together
– [Frontend Service]
– [Backend Service]