Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🦷 SmartSmile - Oral Health Analysis System

A web-based, mobile accessible artificial intelligence system designed for preventive oral health screening using smartphone images. It allows users to take a photo of their teeth using their smartphone camera, upload it to the platform, and receive an instant AI-powered analysis that identifies visible signs of common oral health conditions including calculus, caries, gingivitis, hypodontia, mouth ulcer, and tooth discoloration.

πŸŽ₯ Deployment Link

Watch the SmartSmile system deployed:

[SmartSmile]

🎯 Features

Core Features

  • AI-Powered Analysis: Uses your custom-trained EfficientViT-B0 model
  • 6 Condition Detection:
    • Calculus (Tartar)
    • Caries (Cavities)
    • Gingivitis
    • Hypodontia (Missing Teeth)
    • Mouth Ulcer
    • Tooth Discoloration

User Management

  • User Authentication: Secure signup and login with Supabase
  • Email Verification: Users must verify their email before accessing the dashboard
  • Password Management: Forgot password and password change functionality
  • Profile Settings: Update name, phone, and manage account

Some of Application Pages

  • Home Page: Landing page with system information
  • Dashboard: View screening history and recent results
  • Screening: Upload dental images for AI analysis
  • Results: Detailed analysis with heatmap visualization
  • History: View all past screening results
  • Settings: Account and profile management
  • Education: Oral health education articles
  • About: Information about SmartSmile
  • Contact: Contact form for inquiries
  • Privacy Policy: Data handling and privacy information
  • Terms of Service: User terms and conditions
  • Admin Panel: Admin-only dashboard for platform management

πŸ“Š Model Performance Results

The EfficientViT-B0 model was selected after comparing 20+ deep learning architectures. Here are the results:

EfficientViT-B0 Performance Metrics:

Metric Score
Accuracy 91.94%
Precision 90.54%
Recall 90.72%
F1 Score 90.61%

Model Comparison (Top 5):

Model Accuracy Precision Recall F1 Score
InceptionResnetV2 92.54% 91.06% 91.85% 91.32%
EfficientViT-M2 92.37% 91.74% 92.02% 91.74%
EfficientViT-M5 92.28% 92.15% 90.41% 90.80%
EfficientNetB2 92.10% 92.39% 92.10% 92.21%
EfficientViT-B0 91.94% 90.54% 90.72% 90.61%

Note: EfficientViT-B0 was chosen for deployment due to its excellent balance of accuracy and computational efficiency, making it suitable for real-time applications.

Training Details:

  • Framework: PyTorch with timm library
  • Image Size: 224x224 pixels
  • Training Epochs: 25
  • Optimizer: AdamW
  • Learning Rate: 0.001
  • Dataset: 6-class oral disease classification (6,000+ images)

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • Python 3.8+
  • pip
  • Gmail account (for sending emails) or Supabase account

Installation

  1. Clone the repository
git clone <repository-url>
cd SmartSmile
  1. Install Python dependencies:
cd backend
pip install -r requirements.txt
  1. Install Node.js dependencies:
npm install
  1. Configure Environment Variables:

Create a .env.local file in the root directory:

# Python Backend API URL
PYTHON_API_URL=http://localhost:8000
NEXT_PUBLIC_APP_URL=http://localhost:3000

# Supabase Configuration (get these from your Supabase project)
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_JWT_SECRET=your-jwt-secret
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key

# SMTP Configuration for Custom Emails (Gmail)
SMTP_USERNAME=your-email@gmail.com
SMTP_PASSWORD=your-app-password
EMAIL_FROM_NAME=SmartSmile
EMAIL_FROM_EMAIL=your-email@gmail.com

Running the Application

  1. Start the Python Backend (Terminal 1):
cd backend
python app.py

Server runs at: http://localhost:8000

  1. Start the Frontend (Terminal 2):
npm run dev

App runs at: http://localhost:3000

  1. Open Browser: Go to http://localhost:3000
  2. Sign up for a new account
  3. Verify your email by clicking the link in the welcome email
  4. Log in and start screening!

πŸ“ Project Structure

β”œβ”€β”€ app/                    # Next.js frontend (App Router)
β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”‚   β”œβ”€β”€ analyze/       # Image analysis endpoint
β”‚   β”‚   β”œβ”€β”€ auth/          # Authentication endpoints
β”‚   β”‚   └── email/         # Email sending endpoint
β”‚   β”œβ”€β”€ dashboard/         # User dashboard
β”‚   β”œβ”€β”€ screening/         # Dental image upload & analysis
β”‚   β”œβ”€β”€ results/           # Analysis results display
β”‚   β”œβ”€β”€ history/           # Screening history
β”‚   β”œβ”€β”€ settings/          # Account settings
β”‚   β”œβ”€β”€ admin/             # Admin panel
β”‚   β”œβ”€β”€ education/         # Educational content
β”‚   β”œβ”€β”€ about/             # About page
β”‚   β”œβ”€β”€ contact/           # Contact form
β”‚   β”œβ”€β”€ privacy/           # Privacy policy
β”‚   β”œβ”€β”€ terms/             # Terms of service
β”‚   β”œβ”€β”€ login/             # Login page
β”‚   β”œβ”€β”€ signup/            # Signup page
β”‚   β”œβ”€β”€ verify/            # Email verification page
β”‚   └── page.tsx           # Home/Landing page
β”œβ”€β”€ backend/               # Python FastAPI backend
β”‚   β”œβ”€β”€ app.py             # Main server with endpoints
β”‚   β”œβ”€β”€ model_loader.py    # PyTorch model loading
β”‚   β”œβ”€β”€ inference.py       # Image prediction logic
β”‚   β”œβ”€β”€ email_service.py   # Gmail SMTP email service
β”‚   β”œβ”€β”€ requirements.txt   # Python dependencies
β”‚   └── best_model/        # Trained model files
β”‚       └── efficientvit_b0_oral_disease_classifier.pth
β”œβ”€β”€ components/            # React components
β”‚   └── ui/                # UI component library
β”œβ”€β”€ lib/                   # Utility functions
β”œβ”€β”€ hooks/                 # React hooks
β”œβ”€β”€ best_model/            # Trained model (backup location)
β”œβ”€β”€ notebooks/            # Jupyter notebooks for model training
└── README.md            # This file

πŸŽ₯ Video Demo

Watch the SmartSmile system in action:

[Video Demo Link]

πŸ”§ How It Works

Authentication Flow

  1. User signs up with email and password
  2. SmartSmile sends a verification email via Gmail SMTP
  3. User clicks the verification link to confirm their email
  4. After verification, user can log in and access the dashboard
  5. User can update profile, change password, and manage their account

Screening Flow

  1. User logs in and navigates to the Screening page
  2. User uploads a dental photograph
  3. Image is sent to the Python backend for AI analysis
  4. The EfficientViT-B0 model processes the image
  5. Results are displayed with:
    • Detected condition
    • Confidence score
    • Risk level (Low/Moderate/High)
    • Professional recommendations
    • Heatmap visualization showing areas of concern
  6. Results are saved to user's history

πŸ› οΈ Technology Stack

Frontend

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript
  • UI Components: Custom component library with Tailwind CSS
  • Authentication: Supabase Auth
  • State Management: React hooks and context

Backend

  • Framework: Python FastAPI
  • AI/ML: PyTorch, timm library
  • Model: EfficientViT-B0 (custom trained)
  • Email: Gmail SMTP with custom templates

Database & Auth

  • Database: Supabase (PostgreSQL)
  • Authentication: Supabase Auth with email/password

πŸ“„ API Endpoints

Backend (Python/FastAPI)

  • GET / - API information
  • GET /health - Health check
  • POST /predict - Run inference on dental image
  • POST /email/send-verification - Send verification email
  • POST /email/send-password-reset - Send password reset email
  • POST /email/send-password-changed - Send password changed confirmation

Frontend (Next.js)

  • POST /api/auth/signup - User registration
  • POST /api/auth/login - User login
  • POST /api/auth/verify - Email verification
  • POST /api/analyze - Submit image for analysis
  • POST /api/email/send - Send various email types

⚠️ Important Notes

  • The trained model file must be in backend/best_model/ directory
  • Ensure both servers (frontend and backend) are running before using the application
  • Gmail requires an "App Password" for SMTP - enable 2FA and create an app password
  • Users must verify their email before accessing the dashboard (email verification required)

πŸ” Security Features

  • Email confirmation required before login access
  • Password reset via email
  • Password change notifications
  • Secure Supabase authentication with JWT tokens
  • Service role key used for admin operations only

πŸ“„ License

This project is for educational and demonstration purposes.


About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages