Skip to content

Add complete carbon footprint estimation application with Vite, React, Material UI, Firebase, and OpenAI#1

Merged
gnimnix merged 2 commits intomainfrom
copilot/add-carbon-footprint-estimator
Oct 12, 2025
Merged

Add complete carbon footprint estimation application with Vite, React, Material UI, Firebase, and OpenAI#1
gnimnix merged 2 commits intomainfrom
copilot/add-carbon-footprint-estimator

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 12, 2025

Overview

This PR implements a professional web application for estimating carbon footprints using AI-powered image analysis. The application allows users to upload images and receive detailed carbon footprint estimates, category classifications, and actionable recommendations for reducing their environmental impact.

Technology Stack

Built with the latest versions of modern web technologies:

  • Vite 7.1.7 - Lightning-fast build tool with Hot Module Replacement (HMR)
  • React 19.1.1 - Modern React with TypeScript for type safety
  • Material UI 7.3.4 - Professional component library for polished UI
  • Firebase 12.4.0 - Cloud services integration for storage and backend
  • OpenAI 6.3.0 - GPT-4 Vision API for intelligent image analysis

Key Features

🎨 Professional User Interface

  • Custom Material UI theme with sustainability-focused green color scheme
  • Responsive design with gradient background
  • Clean, intuitive layout with proper spacing and elevation
  • Loading states and error handling for excellent UX

📤 Image Upload

  • Click-to-upload or drag-and-drop functionality
  • File validation (5MB size limit, image formats only)
  • Visual preview of selected images
  • User-friendly error messages

🤖 AI-Powered Analysis

  • Integrates OpenAI's GPT-4 Vision model for image analysis
  • Estimates CO2 emissions in kilograms
  • Categorizes images (transport, food, energy, products, etc.)
  • Provides confidence scores for analysis accuracy
  • Generates 3 specific, actionable recommendations

📊 Detailed Results Display

  • Large, prominent CO2 emissions display
  • Category and confidence chips
  • Organized list of recommendations with icons
  • Color-coded success theme for positive environmental messaging

Project Structure

src/
├── components/
│   └── ImageUpload.tsx      # Main upload and analysis component
├── config/
│   └── firebase.ts          # Firebase configuration
├── services/
│   └── carbonEstimation.ts  # OpenAI API integration
├── App.tsx                  # Main app with Material UI theme
├── main.tsx                 # Application entry point
└── index.css               # Global styles with gradient background

Setup & Configuration

Environment Variables

  • Added .env.example with template for required API keys
  • Updated .gitignore to exclude .env files
  • Clear documentation in README for setup process

Security Considerations

  • API keys stored in environment variables
  • .env excluded from version control
  • README includes warning about browser-side API usage (development only)
  • Notes provided for production implementation with backend proxy

Documentation

Comprehensive README includes:

  • Feature overview with emojis for visual clarity
  • Prerequisites and system requirements
  • Step-by-step setup instructions
  • Technology stack details
  • Project structure explanation
  • Security best practices
  • Usage instructions
  • Contributing guidelines

Quality Assurance

  • Linting: ESLint passes with no errors
  • Type Checking: TypeScript compiles successfully
  • Build: Production build successful (461.45 kB, gzipped: 141.12 kB)
  • Testing: Manually verified UI and functionality
  • Dependencies: All packages using latest stable versions

Usage

  1. Install dependencies: npm install
  2. Configure environment: cp .env.example .env and add API keys
  3. Start development server: npm run dev
  4. Upload an image and click "Analyze Carbon Footprint"
  5. View detailed results with CO2 estimates and recommendations

Future Enhancements

  • Backend API proxy for secure API key management
  • User authentication with Firebase Auth
  • Image storage in Firebase Storage
  • History of previous analyses
  • Comparison features for multiple images
  • Export results as PDF reports

This implementation provides a solid foundation for the ING 2030 initiative, offering users an interactive way to understand and reduce their carbon footprint through AI-powered insights.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • images.unsplash.com
    • Triggering command: curl -o test-car.jpg REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

use vitejs latest and firebase and an AI backend (openAI, Sora) that accepts a user uploaded image and estimates its carbon footprint, Material UI should also be used so the website looks professional


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: gnimnix <47523729+gnimnix@users.noreply.github.com>
Copilot AI changed the title [WIP] Add image upload feature for carbon footprint estimation Add complete carbon footprint estimation application with Vite, React, Material UI, Firebase, and OpenAI Oct 12, 2025
Copilot AI requested a review from gnimnix October 12, 2025 14:50
@gnimnix gnimnix marked this pull request as ready for review October 12, 2025 14:58
@gnimnix gnimnix merged commit 14d6f02 into main Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants