Table of Contents
- Project Overview
- Repository Structure
- Tech Stack
- Getting Started
- Usage & API
- AI_Part Module
- Sample Data
- Contributing
- License
Sections
apna‑nfd ingests industrial metrics, uses a PyTorch model to predict carbon footprints, and delivers sustainability recommendations via an AI chatbot. It’s split into backend, frontend, and an AI_Part module for recommendation logic.
├── AI_Part/ # Chatbot & recommendation engine
├── backend/ # FastAPI service, PyTorch model, templates
│ ├── app.py
│ ├── asgi.py
│ ├── model/carbon_model.pth
│ ├── data/sample_input.csv
│ ├── data/sample_output.csv
│ ├── static/css/style.css
│ └── templates/index.html
├── frontend/ # React/TypeScript SPA
│ ├── package.json
│ ├── public/index.html
│ └── src/
├── sample_data.csv # Combined sample data
└── index.html # ← this file
- Backend: FastAPI (ASGI) , Uvicorn, Pydantic
- Model: PyTorch
.pthserialization - Chatbot: Groq AI integration
- Frontend: React, TypeScript, Vite
- Containerization: Docker & Docker Compose
- Docs: Swagger UI & ReDoc (OpenAPI)
cd backend
pip install -r requirements.txt
uvicorn asgi:asgi_app --reload --host 0.0.0.0 --port 8000
cd frontend
npm install
npm run dev # http://localhost:3000
# docker-compose.yml version: '3.8' services: backend: build: ./backend ports: ["8000:8000"] frontend: build: ./frontend ports: ["3000:3000"]
docker-compose up --build
| Route | Method | Description |
|---|---|---|
| / | GET | Dashboard HTML |
| /predict | POST | Industrial metrics → carbon prediction |
| /chat | POST | AI sustainability advice |
AI_Part/
├── chatbot.py # Message handling
├── recommendations/ # Prompt templates & logic
└── utils.py
Run CLI tests: python AI_Part/chatbot.py
backend/data/sample_input.csvbackend/data/sample_output.csvsample_data.csv
- Fork & create branch (
feature/xyz) - Commit with Conventional Commits
- Open a Pull Request against
main
MIT License. See LICENSE for details.