Skip to content

🌿 AI-powered plant health analysis platform. Upload a plant image to get species identification, health diagnosis, and care recommendations.

Notifications You must be signed in to change notification settings

Om7035/Green-Sense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 Green-Sense - AI Plant Health Analyzer

Professional plant identification with AI-powered health assessment - 100% Free APIs, Production-Ready, Fully Deployable

Deploy to Vercel License: MIT


✨ Features

  • πŸ”¬ Multi-AI Plant Identification - Plant.id, Google Gemini 2.5, PlantNet APIs
  • πŸ›‘οΈ Smart Image Validation - Detects if uploaded image contains a plant
  • 🦠 Disease Detection - Identifies plant diseases and health issues
  • πŸ’š Health Assessment - AI-powered condition analysis
  • 🌱 Species Recognition - Common & scientific names, plant families
  • πŸ“‹ Tailored Care Guides - Species-specific recommendations
  • πŸ“… Seasonal Calendar - Year-round care schedule
  • πŸ”§ Troubleshooting - Common problems and solutions
  • πŸ“„ PDF Reports - Professional reports with plant images
  • πŸ’° 100% FREE - No credit card required, 2,000+ free IDs/day
  • πŸš€ Production-Ready - Fully deployable on Vercel, Render, Railway

πŸ—οΈ Architecture

User Upload Image
    ↓
Image Validation (Gemini 2.5) - Ensures it's a plant
    ↓
Plant Identification:
  1. Plant.id API (Primary) - 100/day FREE
  2. Google Gemini 2.5 Flash (Backup) - 1,500/day FREE
  3. PlantNet API (Backup) - 500/day FREE
  4. Knowledge Base (Always works) - Unlimited
    ↓
Care Recommendations (Knowledge Base)
    ↓
PDF Report Generation

Four-Tier Fallback System:

  • Never fails completely
  • Automatic fallback to next API if one fails
  • Knowledge base provides general care if all APIs unavailable

πŸš€ Quick Start

1. Clone & Install

git clone https://github.com/YOUR_USERNAME/Green-Sense.git
cd Green-Sense
npm install

2. Get FREE API Keys

Google Gemini (Required) - 1,500/day FREE

  1. Visit: https://aistudio.google.com/app/apikey
  2. Sign in with Google account
  3. Click "Create API Key"
  4. Copy the key (starts with AIza...)

Plant.id (Optional) - 100/day FREE

  1. Visit: https://web.plant.id/
  2. Sign up (free, no credit card)
  3. Get API key from dashboard

PlantNet (Optional) - 500/day FREE

  1. Visit: https://my.plantnet.org/
  2. Create account
  3. Get API key

3. Configure Environment

cp .env.example .env

Edit .env file:

# Required - For plant identification and image validation
GEMINI_API_KEY=your_gemini_api_key_here

# Optional - For enhanced plant identification
PLANTID_API_KEY=your_plantid_api_key_here

# Optional - Additional fallback
PLANTNET_API_KEY=your_plantnet_api_key_here

4. Start Server

npm start

5. Open in Browser

http://localhost:5000

πŸ“Š What You Get

Upload a Plant Image:

Step 0/3: Validating image contains a plant...
βœ… Plant image validated (confidence: high)
Detected: Monstera plant

Step 1/3: Analyzing YOUR plant with Plant.id AI...
🌿 Plant.id identified: Monstera (Monstera deliciosa)
πŸ“Š Confidence: 87.3%
🏷️  Family: Araceae
πŸ’š Health: healthy

Step 2/3: Generating tailored care guide...
βœ… Care recommendations generated!

🌿 PLANT ANALYSIS REPORT

πŸ“‹ IDENTIFICATION
β€’ Common Name: Monstera
β€’ Scientific Name: Monstera deliciosa
β€’ Family: Araceae
β€’ Confidence: 87.3%

πŸ’š HEALTH ASSESSMENT
β€’ Status: healthy
β€’ No diseases detected

πŸ’š CARE REQUIREMENTS
β€’ Watering: Water when top 1-2 inches dry
β€’ Light: Bright, indirect light
β€’ Humidity: 50-60%, mist regularly
β€’ Temperature: 65-80Β°F (18-27Β°C)
β€’ Soil: Well-draining with peat moss
β€’ Fertilizer: Monthly during growing season

πŸ“… SEASONAL CARE GUIDE
[Spring, Summer, Fall, Winter tasks]

πŸ”§ TROUBLESHOOTING GUIDE
[Yellow leaves, brown tips, wilting, etc.]

Upload a Non-Plant Image:

Step 0/3: Validating image contains a plant...
❌ Not a plant detected: cat
Reason: Image shows an animal, not a plant

Error: This appears to be cat, not a plant. 
Please upload an image of a plant.

πŸ’° Cost Breakdown

Service Daily Limit Features Cost
Google Gemini 2.5 1,500 Vision + ID + Validation FREE
Plant.id 100 ID + Health + Disease FREE
PlantNet 500 ID + Scientific names FREE
Knowledge Base Unlimited Care + Tips + Troubleshooting FREE
Total 2,100+ Everything $0/month

🌐 Deploy to Vercel

One-Click Deploy

Deploy with Vercel

Manual Deploy

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

# Add environment variables in Vercel dashboard:
# - GEMINI_API_KEY
# - PLANTID_API_KEY (optional)
# - PLANTNET_API_KEY (optional)

🎯 Tech Stack

  • Backend: Node.js, Express
  • AI APIs:
    • Google Gemini 2.5 Flash (vision + text)
    • Plant.id API (plant identification)
    • PlantNet API (botanical database)
  • Image Processing: Sharp
  • PDF Generation: PDFKit
  • Knowledge Base: JSON databases
  • Deployment: Vercel serverless functions

πŸ“ Project Structure

Green-Sense/
β”œβ”€β”€ app.js                 # Main Express server
β”œβ”€β”€ public/
β”‚   └── index.html        # Frontend UI
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ gemini-vision.js  # Gemini 2.5 integration
β”‚   β”œβ”€β”€ plantid-api.js    # Plant.id integration
β”‚   β”œβ”€β”€ care-engine.js    # Care recommendations
β”‚   └── image-validator.js # Plant image validation
β”œβ”€β”€ knowledge/
β”‚   β”œβ”€β”€ plant-care.json   # Care database
β”‚   └── plant-diseases.json # Disease database
β”œβ”€β”€ .env                  # Environment variables
└── package.json          # Dependencies

πŸ”’ Privacy & Security

  • βœ… Images processed in memory, deleted after analysis
  • βœ… No data stored on server
  • βœ… No user tracking or analytics
  • βœ… API keys stored securely in environment variables
  • βœ… CORS enabled for secure cross-origin requests

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Google Gemini - For powerful vision AI capabilities
  • Plant.id - For specialized plant identification
  • PlantNet - For botanical database access
  • Open-source community - For amazing tools and libraries

πŸ“§ Contact

For questions or support, please open an issue on GitHub.


Built with 🌿 for plant lovers everywhere

Upload your plant image and get instant analysis! πŸŽ‰


🎯 What You Get

When you upload a plant image, the AI provides:

🌿 PLANT ANALYSIS REPORT

1. PLANT IDENTIFICATION

  • Specific species or genus
  • Common and scientific names
  • Key identifying features
  • Plant family

2. HEALTH ASSESSMENT

  • Overall health status
  • Leaf condition analysis
  • Disease/pest detection
  • Stress indicators

3. SPECIFIC OBSERVATIONS

  • Detailed description of YOUR plant
  • Leaf characteristics
  • Growth pattern
  • Visible issues

4. CARE RECOMMENDATIONS

  • Watering schedule (for this species)
  • Light requirements
  • Soil preferences
  • Fertilization guide
  • Pruning tips
  • Temperature/humidity needs

5. IMMEDIATE ACTIONS

  • Urgent issues to address
  • Specific treatments
  • Preventive measures

6. LONG-TERM CARE

  • Seasonal care tips
  • Common problems
  • Growth expectations
  • Repotting guidance

πŸ’° Cost

$0/month - Gemini API Free Tier:

  • 15 requests per minute
  • 1,500 requests per day
  • 1 million requests per month

Perfect for personal use and portfolio projects!


πŸ› οΈ Tech Stack

Component Technology
AI Vision Google Gemini 1.5 Pro
Backend Node.js + Express
Image Processing Sharp
PDF Generation PDFKit
Frontend Vanilla JS + TailwindCSS

πŸ“ Project Structure

green-sense/
β”œβ”€β”€ app.js                 # Main server with Gemini integration
β”œβ”€β”€ package.json           # Dependencies
β”œβ”€β”€ .env                   # API key (not in git)
β”œβ”€β”€ .env.example           # Configuration template
β”œβ”€β”€ public/
β”‚   └── index.html         # Frontend interface
β”œβ”€β”€ upload/                # Temporary image storage
└── reports/               # Generated PDF reports

πŸ”§ API Endpoints

POST /analyze

  • Input: Multipart form data with image file
  • Process: Analyzes image with Gemini Vision AI
  • Output: JSON with analysis and base64 image

POST /download

  • Input: JSON with analysis text and image
  • Process: Generates PDF report
  • Output: Downloadable PDF file

πŸŽ“ For Your Resume

Green-Sense - AI-Powered Plant Health Analysis Platform

β€’ Developed full-stack web application for plant identification and health assessment
β€’ Integrated Google Gemini 1.5 Vision API for accurate image analysis and species identification
β€’ Implemented multipart file upload with Sharp for image optimization
β€’ Built PDF report generation system with embedded images using PDFKit
β€’ Designed RESTful API with Express.js for seamless frontend-backend communication
β€’ Optimized for zero-cost deployment using free tier APIs ($0/month operational cost)
β€’ Demonstrated problem-solving by migrating from unstable APIs to reliable Gemini platform

Tech Stack: Node.js, Express.js, Google Gemini AI, Sharp, PDFKit, TailwindCSS

🎀 Interview Talking Points

Q: Tell me about this project

"Green-Sense is an AI-powered plant health analyzer that uses Google's Gemini Vision API to identify plant species and assess their health from photos. Users upload images and receive detailed, species-specific care recommendations. The challenge was integrating vision AI reliably while maintaining zero operational costs."

Q: What was the biggest technical challenge?

"Initially, I tried using Hugging Face's free vision models, but they had reliability issues with the new Inference Providers API. I pivoted to Google's Gemini 1.5 Flash, which offers excellent vision capabilities with a generous free tier. This taught me the importance of API evaluation and having backup plans."

Q: How does it work technically?

"The backend uses Express with Multer for file uploads. Images are processed with Sharp for optimization, then sent to Gemini's vision model with a detailed botanical analysis prompt. The AI identifies the species, assesses health, and provides tailored care advice. Results are displayed in the browser and can be downloaded as PDF reports with PDFKit."

Q: How would you scale this?

"Current architecture handles 1,500 requests/day on free tier. For scaling, I'd implement Redis caching for repeated plant species, add user accounts with history tracking, implement rate limiting per user, and potentially add a CDN for static assets. Could also batch similar requests or use webhooks for async processing."


πŸš€ Deployment

Option 1: Render (Recommended)

  1. Push code to GitHub
  2. Connect Render to repository
  3. Add GEMINI_API_KEY environment variable
  4. Deploy!

Option 2: Railway

  1. Connect Railway to GitHub
  2. Set environment variable
  3. Auto-deploy on push

Option 3: Vercel (Serverless)

  1. Install Vercel CLI: npm i -g vercel
  2. Run: vercel
  3. Add environment variable in dashboard

πŸ”’ Security Best Practices

βœ… Never commit .env file - Already in .gitignore βœ… Use environment variables - API keys not in code βœ… Validate file uploads - Multer configuration βœ… Clean up temp files - Automatic deletion after processing βœ… Rate limiting - Built into Gemini API βœ… CORS configured - Secure cross-origin requests


πŸ› Troubleshooting

"Error: GEMINI_API_KEY not found"

  • Check .env file exists
  • Verify API key is correct
  • Restart server after changing .env

"API quota exceeded"

"Image upload fails"

  • Max file size: 10MB
  • Supported formats: JPG, PNG, WEBP
  • Check upload/ directory permissions

"PDF download not working"

  • Ensure reports/ directory exists
  • Check disk space
  • Verify PDFKit installation

πŸ“š Documentation


🎯 Future Enhancements

  • User accounts and plant history
  • Plant health tracking over time
  • Community features (share plants)
  • Mobile app (React Native)
  • Multiple language support
  • Plant disease database
  • Care reminders and notifications
  • Integration with plant care APIs

πŸ“„ License

MIT License - Feel free to use for your portfolio!


πŸ™ Acknowledgments

  • Google Gemini AI for vision capabilities
  • TailwindCSS for beautiful UI
  • The open-source community

πŸ“ž Support

Having issues? Check:

  1. .env file is configured correctly
  2. Gemini API key is valid
  3. Dependencies are installed: npm install
  4. Server is running: npm start
  5. Port 5000 is not in use

Made with πŸ’š for plant lovers and AI enthusiasts

Perfect for: Portfolio projects, job applications, learning AI integration

Status: βœ… Production Ready | πŸ’° $0/month | πŸš€ Deploy Anywhere

About

🌿 AI-powered plant health analysis platform. Upload a plant image to get species identification, health diagnosis, and care recommendations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published