Skip to content

NeuraGreen is an AI-powered web application that helps users make environmentally conscious shopping decisions by analyzing and ranking Amazon products based on their estimated carbon footprint.

License

Notifications You must be signed in to change notification settings

Tanishq-789/NeuraGreen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 NeuraGreen - AI-Powered Carbon Footprint Analyzer

License: MIT Python 3.9+ React


πŸ“Œ Overview:

NeuraGreen is a full-stack web application that:

  1. Lets users input or scrape Amazon product data
  2. Uses Gemini AI to analyze the product's carbon footprint
  3. Recommends top 3 lower-carbon alternatives based on the analysis

πŸ› οΈ Tech Stack

Component Technology Purpose
Frontend React + Vite Fast UI & SPA structure
Backend Python + FastAPI API layer for scraping & AI analysis
AI Model Gemini API (Google) Carbon footprint estimation
Scraper BeautifulSoup/Selenium Amazon product scraping
CSV Logging Pandas Save scraped product analysis

πŸ”§ Installation

πŸ” Clone & Setup

git clone https://github.com/yourusername/NeuraGreen.git
cd NeuraGreen

πŸ“¦ Backend Setup

cd server
python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate on Windows
pip install -r requirements.txt

πŸ’» Frontend Setup

cd ../
npm install

πŸ” Configuration

Create a .env file in the root directory:

VITE_GEMINI_API_KEY="your_gemini_api_key"    #πŸ€– Gemini API Key β†’ Get your key for Google AI (https://makersuite.google.com/app/apikey)
VITE_API_URL=http://localhost:8000
VITE_CLERK_PUBLISHABLE_KEY="your_clerk_api_key"   #πŸ”‘ Get your Clerk API keys at the [Clerk Dashboard](https://dashboard.clerk.dev)  
β†’ Go to your application β†’ API Keys section

You can also configure backend environment variables (if needed) in server/.env.


πŸš€ Running the App

πŸ–₯️ Start Frontend (React)

npm run dev

🧠 Start Backend (FastAPI)

cd server
uvicorn main:app --reload

πŸ“‚ Project Structure

NeuraGreen/
β”œβ”€β”€ public/
β”‚   └── vite.svg
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ api/                 # API services
β”‚   β”œβ”€β”€ assets/              # Static images/icons
β”‚   β”œβ”€β”€ components/          # UI Components
β”‚   β”œβ”€β”€ pages/               # Route Pages (Home, Results)
β”‚   β”œβ”€β”€ App.jsx
β”‚   β”œβ”€β”€ main.jsx
β”‚   └── index.css
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ routers/
β”‚   β”‚   β”œβ”€β”€ analyze.py       # API route for analysis
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ gemini.py        # Gemini API integration
β”‚   β”‚   β”œβ”€β”€ scraper.py       # Amazon scraping logic
β”‚   β”œβ”€β”€ main.py              # FastAPI entry point
β”‚   β”œβ”€β”€ requirements.txt
β”œβ”€β”€ Output/
β”‚   └── scraped_products.csv # CSV file with outputs
β”œβ”€β”€ .env
β”œβ”€β”€ index.html
β”œβ”€β”€ package.json
β”œβ”€β”€ vite.config.js
└── README.md

🌟 Key Features

πŸ” Product Scraping Logic (scraper.py)

def scrape_product_data(url: str) -> dict:
    # Extracts title, price, and product attributes
    soup = BeautifulSoup(requests.get(url).text, 'html.parser')
    title = soup.find("span", {"id": "productTitle"}).text.strip()
    return {"title": title}

πŸ€– AI-Based Carbon Analysis (gemini.py)

def analyze_product_footprint(title: str) -> str:
    prompt = f"Estimate carbon footprint of {title}"
    response = gemini.generate_content(prompt)
    return response.text

πŸ§ͺ Example Usage

Frontend calls:

// src/api/productApi.js
export const analyzeProduct = async (title) => {
  const response = await fetch("/api/analyze", {
    method: "POST",
    body: JSON.stringify({ title }),
  });
  return await response.json();
};

πŸ§ͺ Output:

image


πŸ“œ License

MIT Β© [Tanishq Shinde]


Crafted with 🌱 by Tanishq using React, FastAPI, and Gemini AI

About

NeuraGreen is an AI-powered web application that helps users make environmentally conscious shopping decisions by analyzing and ranking Amazon products based on their estimated carbon footprint.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published