Skip to content

aicoder2009/SnakeID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SnakeID

Live: https://snakeid-karthickaruns-projects.vercel.app

A Progressive Web App that identifies snakes using AI-powered computer vision to help users determine if a snake is venomous or not.

🐍 Overview

SnakeID allows users to take photos of snakes and receive instant AI-powered identification with safety information. The app determines whether a snake is venomous, mildly venomous, or not venomous, providing detailed descriptions to help users make informed decisions about snake encounters.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   AWS Lambda     β”‚    β”‚   OpenAI API    β”‚
β”‚   (Next.js PWA)│───▢│   Function       │───▢│   Vision Model  β”‚
β”‚                 β”‚    β”‚                  β”‚    β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚
         β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   CloudFront    β”‚    β”‚   Function URL   β”‚
β”‚   Distribution  β”‚    β”‚   (HTTPS)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   S3 Bucket     β”‚
β”‚   Static Hostingβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

SnakeID/
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ index.tsx          # Main application page
β”‚   β”‚   └── _app.tsx           # Next.js app wrapper
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── ui/
β”‚   β”‚       └── button.tsx     # Reusable button component
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   └── manifest.json      # PWA manifest
β”‚   β”œβ”€β”€ deploy-s3.sh          # S3 deployment script (new bucket)
β”‚   β”œβ”€β”€ deploy-existing.sh     # Quick deploy to existing bucket
β”‚   β”œβ”€β”€ next.config.js         # Next.js configuration
β”‚   β”œβ”€β”€ tailwind.config.js     # Tailwind CSS configuration
β”‚   β”œβ”€β”€ package.json           # Dependencies and scripts
β”‚   └── tsconfig.json          # TypeScript configuration
β”œβ”€β”€ backend/
β”‚   └── deploy-lambda.sh       # Lambda deployment script
β”œβ”€β”€ .gitignore                # Git ignore rules
└── README.md                 # Project documentation

πŸ› οΈ Technology Stack

Frontend

  • Next.js 14 - React framework with static site generation
  • TypeScript - Type-safe JavaScript
  • Tailwind CSS - Utility-first CSS framework
  • Lucide React - Icon library
  • PWA Features - Offline capability, installable

Backend

  • AWS Lambda - Serverless compute for image processing
  • OpenAI Vision API - AI-powered snake identification
  • AWS Lambda Function URLs - Direct HTTPS endpoints

Infrastructure

  • Amazon S3 - Static website hosting
  • Amazon CloudFront - Global CDN for fast delivery
  • AWS CLI - Deployment automation

πŸ“± Features

Camera Functionality

  • Live Camera Preview - Real-time video feed
  • Camera Switching - Toggle between front/rear cameras
  • Manual Capture - Take photos with explicit user action
  • Mobile Optimized - Touch-friendly interface

AI Identification

  • Instant Analysis - Real-time snake identification
  • Safety Classification - Venomous, mildly venomous, or not venomous
  • Detailed Descriptions - Comprehensive information about identified species
  • Visual Indicators - Color-coded safety status

Progressive Web App

  • Installable - Add to home screen on mobile devices
  • Responsive Design - Works on all screen sizes
  • Fast Loading - Optimized performance with CDN

🎯 Use Cases

1. Outdoor Enthusiasts

  • Hikers - Identify snakes encountered on trails
  • Campers - Assess safety around campsites
  • Nature Photographers - Learn about snake species

2. Educational Purposes

  • Students - Learn snake identification skills
  • Teachers - Educational tool for biology classes
  • Researchers - Quick field identification

3. Safety Applications

  • Homeowners - Identify snakes in yards or gardens
  • Emergency Responders - Quick species identification for medical treatment
  • Wildlife Control - Professional snake identification

πŸ”„ How It Works

1. Image Capture

User opens app β†’ Camera preview β†’ Take picture β†’ Image captured

2. AI Processing

Image sent to Lambda β†’ OpenAI Vision API β†’ Snake analysis β†’ Safety classification

3. Result Display

AI response β†’ Safety status β†’ Detailed description β†’ Visual indicators

πŸš€ Deployment

Prerequisites

  • AWS CLI configured
  • Node.js 18+
  • OpenAI API key

Local Development

# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Run development server
npm run dev

# Open browser to http://localhost:3000

Frontend Deployment

# Build and deploy to new S3 bucket with CloudFront
cd frontend
./deploy-s3.sh

# Or quick deploy to existing bucket
cd frontend
./deploy-existing.sh

# Or manual deployment
cd frontend
npm run build
aws s3 sync out/ s3://snake-identifier-pwa-1761012570 --delete

# Invalidate CloudFront cache for immediate updates
aws cloudfront create-invalidation --distribution-id ENM5YUS3HN3KM --paths "/*"

Backend Deployment

# Deploy Lambda function
./backend/deploy-lambda.sh

πŸ“Š Safety Classifications

Status Color Description
Venomous πŸ”΄ Red Dangerous - seek immediate medical attention if bitten
Mildly Venomous 🟑 Yellow Caution - may cause mild symptoms
Not Venomous 🟒 Green Generally safe - still avoid handling

πŸ”§ Configuration

Environment Variables

  • OPENAI_API_KEY - OpenAI API key for vision processing
  • AWS_REGION - AWS region for Lambda deployment

Current Deployment

Lambda Function URL

The app is currently configured to use:

const response = await fetch('https://42znlandtww7wnpuarx5dy2rt40kajds.lambda-url.us-east-1.on.aws/', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ image: imageData.split(',')[1] })
})

πŸ“± Mobile Experience

Camera Controls

  • Large capture button - Easy to tap "Take Picture" button
  • Camera flip - Switch between front/rear cameras
  • Cancel option - Exit camera without taking photo

Responsive Design

  • Mobile-first - Optimized for smartphone usage
  • Touch-friendly - Large buttons and intuitive gestures
  • Fast loading - Optimized images and code splitting

πŸ”’ Security & Privacy

  • HTTPS Only - All communications encrypted
  • No Image Storage - Images processed in real-time, not stored
  • API Security - OpenAI API key secured in Lambda environment
  • CORS Protection - Proper cross-origin resource sharing

🌐 Browser Support

  • Chrome/Safari - Full camera API support
  • Firefox - Full functionality
  • Mobile browsers - Optimized experience
  • PWA Support - Install on iOS/Android

πŸ“ˆ Performance

  • CDN Delivery - Global CloudFront distribution
  • Static Generation - Pre-built pages for fast loading
  • Image Optimization - Compressed assets
  • Lazy Loading - Components loaded on demand

🀝 Contributing

  1. Fork the repository
  2. Create feature branch
  3. Make changes
  4. Test thoroughly
  5. Submit pull request

⚠️ Disclaimer

This app is for educational and informational purposes only. Always consult with wildlife experts or medical professionals for snake-related emergencies. The AI identification may not be 100% accurate in all cases.

About

AI-powered snake identification PWA using OpenAI Vision API. Instantly identifies snake species and provides venomous/non-venomous classification with emergency safety guidance. Built with Next.js, TypeScript, Tailwind CSS, and AWS Lambda.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors