---
title: Sanket Setu
emoji: ๐
colorFrom: blue
colorTo: purple
sdk: docker
sdk_version: 4.36.1
python_version: 3.1
app_file: app.py
pinned: false
license: mit
short_description: Gujarati Sign Language Translator using AI
---
# ๐ค SanketSetu | เชธเชเชเซเชค-เชธเซเชคเซ
**Real-time Gujarati Sign Language Recognition System**
[](https://sanket-setu.vercel.app)
[](https://huggingface.co/spaces/devrajsinh2012/Sanket-Setu)
[](#license)
---
## ๐ About
**SanketSetu** (Sanskrit: *Sanket* = gesture/sign, *Setu* = bridge) is a production-grade, real-time **Gujarati Sign Language (GSL)** recognition system. It bridges the communication gap between the hearing-impaired community and the broader public by translating hand gestures corresponding to **34 Gujarati consonants** (เชโเชเซเช) into text โ all in real time, directly in the browser.
The system uses your device camera, processes hand landmarks locally via **MediaPipe**, and sends them over a **WebSocket** connection to a machine-learning backend that classifies the gesture using a **3-pipeline ensemble** of models.
---
## โจ Features
- **Real-time gesture detection** โ sub-100 ms end-to-end latency
- **3-pipeline ensemble inference** โ XGBoost โ Autoencoder+LightGBM โ CNN+SVM, invoked in order of confidence
- **34 Gujarati sign classes** โ complete consonant alphabet (เช, เช, เช โฆ เชเซเชท, เชเซเช)
- **WebSocket streaming** โ live bidirectional communication between browser and backend
- **MediaPipe hand tracking** โ 21 landmark coordinates extracted client-side (no raw video sent to server)
- **Onboarding wizard** โ animated step-by-step guide for first-time users
- **Calibration screen** โ transparent overlay keeps camera feed fully visible while detecting hand readiness
- **Landmark canvas overlay** โ live 21-point skeleton drawn over the webcam feed
- **Prediction HUD** โ displays recognised sign, confidence bar, latency, and prediction history
- **Low-bandwidth mode** โ auto-throttles to 5 fps when latency is high
- **Docker-ready backend** โ deployable on Hugging Face Spaces in one push
---
## ๐๏ธ System Architecture
```
Browser (React + TypeScript)
โ
โโ MediaPipe Hands (WASM) โ extracts 21 hand landmarks (63 floats) locally
โโ WebcamFeed + LandmarkCanvas
โโ Calibration / Onboarding UI
โ
โโ WebSocket (wss://)
โ
โผ
FastAPI Backend (Python)
โ
โโ Pipeline A โ XGBoost (63 landmarks โ 34 classes) โ primary, fastest
โ โโ if confidence < 0.70 โ
โโ Pipeline B โ Autoencoder (63โ16) + LightGBM โ secondary
โ โโ if confidence < 0.60 โ
โโ Pipeline C โ ResNet50 CNN (128ร128 image) + SVM โ tertiary
โโ Ensemble weighted average โ final prediction
```
---
## ๐ Project Structure
```
SanketSetu/
โโโ backend/
โ โโโ app/
โ โ โโโ main.py # FastAPI entry-point, WebSocket + REST
โ โ โโโ config.py # Settings (thresholds, model paths, env vars)
โ โ โโโ schemas.py # Pydantic request/response models
โ โ โโโ inference/
โ โ โ โโโ pipeline_a.py # XGBoost inference (63 MediaPipe landmarks)
โ โ โ โโโ pipeline_b.py # Autoencoder encoder + LightGBM
โ โ โ โโโ pipeline_c.py # ResNet CNN + SVM (image-based)
โ โ โ โโโ ensemble.py # Confidence-weighted ensemble logic
โ โ โโโ models/
โ โ โโโ loader.py # Singleton model loader
โ โ โโโ label_map.py # Index 0โ33 โ Gujarati character
โ โโโ tests/ # Pytest test suite
โ โโโ requirements.txt
โ โโโ requirements-dev.txt
โ
โโโ frontend/
โ โโโ src/
โ โ โโโ App.tsx # App shell, stage machine (onboarding โ calibration โ running)
โ โ โโโ components/
โ โ โ โโโ WebcamFeed.tsx # Webcam stream + canvas overlay
โ โ โ โโโ LandmarkCanvas.tsx # Draws 21-point hand skeleton
โ โ โ โโโ PredictionHUD.tsx # Live sign, confidence bar, latency, history
โ โ โ โโโ OnboardingGuide.tsx # Animated intro wizard
โ โ โ โโโ Calibration.tsx # Transparent hand-detection calibration card
โ โ โโโ hooks/
โ โ โ โโโ useWebSocket.ts # WS connection, send/receive
โ โ โ โโโ useMediaPipe.ts # MediaPipe Hands JS integration
โ โ โ โโโ useWebcam.ts # Camera permissions + stream
โ โ โโโ lib/
โ โ โโโ landmarkUtils.ts # Landmark normalisation helpers
โ โโโ .env.production # VITE_WS_URL for Vercel build
โ โโโ vite.config.ts
โ โโโ package.json
โ
โโโ CNN_Autoencoder_LightGBM/ # Autoencoder + LightGBM model weights
โโโ CNN_PreTrained/ # ResNet CNN + SVM model weights
โโโ Mediapipe_XGBoost/ # XGBoost model weights
โโโ Dockerfile # Multi-stage Docker build for HF Spaces
โโโ start.ps1 # One-command local dev launcher (Windows)
```
---
## ๐ ๏ธ Tech Stack
| Layer | Technology |
|---|---|
| **Frontend** | React 18, TypeScript, Vite, TailwindCSS, Framer Motion |
| **Hand Tracking** | MediaPipe Hands (browser WASM) |
| **Real-time Comm.** | WebSocket (native browser API) |
| **Backend** | FastAPI, Python 3.10+ |
| **ML โ Pipeline A** | XGBoost (scikit-learn API) |
| **ML โ Pipeline B** | Keras/TensorFlow Autoencoder + LightGBM |
| **ML โ Pipeline C** | PyTorch ResNet50 CNN + scikit-learn SVM |
| **Deployment** | Hugging Face Spaces (Docker SDK) + Vercel |
---
## ๐ Getting Started
### Prerequisites
- Python 3.10+
- Node.js 18+
- npm or yarn
### 1. Clone the repository
```bash
git clone https://github.com/devrajsinh2012/Sanket-Setu.git
cd Sanket-Setu
```
### 2. Backend Setup
```bash
cd backend
pip install -r requirements.txt
# Starts FastAPI server on http://localhost:8000
python -m app.main
```
### 3. Frontend Setup
```bash
cd frontend
npm install
# Starts Vite dev server on http://localhost:5173
npm run dev
```
### 4. One-Command Start (Windows)
```powershell
# From the repo root โ starts both backend and frontend
.\start.ps1
```
---
## ๐งช Testing
```bash
cd backend
pytest tests/ -v
```
---
## ๐ณ Docker (Local)
```bash
# Build the image
docker build -t sanketsetu .
# Run on port 7860 (matches HF Spaces)
docker run -p 7860:7860 sanketsetu
```
---
## โ๏ธ Deployment
### Backend โ Hugging Face Spaces
The backend runs as a [Hugging Face Space](https://huggingface.co/spaces/devrajsinh2012/Sanket-Setu) using the **Docker SDK**.
**Push to the Space:**
```bash
# From repo root
git push space main
```
HF Spaces automatically builds the Docker image and serves the container on port 7860.
**Space Secrets** (HF Space โ Settings โ Repository secrets):
| Secret | Example value |
|--------|---------------|
| `CORS_ORIGINS` | `https://sanket-setu.vercel.app,http://localhost:5173` |
| `PIPELINE_MODE` | `ensemble` |
| `CONFIDENCE_THRESHOLD` | `0.70` |
**Live URLs:**
| Endpoint | URL |
|---|---|
| Health check | `https://devrajsinh2012-sanket-setu.hf.space/health` |
| WebSocket | `wss://devrajsinh2012-sanket-setu.hf.space/ws/landmarks` |
### Frontend โ Vercel
Connect the GitHub repository in the [Vercel dashboard](https://vercel.com) and add the **Environment Variable**:
| Variable | Value |
|---|---|
| `VITE_WS_URL` | `wss://devrajsinh2012-sanket-setu.hf.space` |
Vercel auto-deploys on every push to `main`.
---
## ๐ง Environment Variables
| Variable | Scope | Default | Description |
|---|---|---|---|
| `VITE_WS_URL` | Frontend (build-time) | โ | WebSocket URL of the backend |
| `CORS_ORIGINS` | Backend (runtime) | `*` | Comma-separated allowed origins |
| `PIPELINE_MODE` | Backend (runtime) | `ensemble` | `ensemble` / `A` / `B` / `C` |
| `CONFIDENCE_THRESHOLD` | Backend (runtime) | `0.70` | Primary confidence cutoff |
| `SECONDARY_THRESHOLD` | Backend (runtime) | `0.60` | Secondary confidence cutoff |
| `WEIGHTS_DIR` | Backend (runtime) | repo root | Override path to model weight files |
---
## ๐ค Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
---
## ๐ฅ Team & Acknowledgements
This project was developed by:
| Name | Contribution |
|---|---|
| **Devrajsinh Gohil** | Full-stack development, ML integration, deployment |
| **Jay Nasit** | Machine learning models, dataset preparation, testing |
**Guided by:** Dr. Om Prakash Suthar
> We express our sincere gratitude to **Dr. Om Prakash Suthar** for his invaluable guidance, encouragement, and technical insights throughout the development of SanketSetu. His mentorship was instrumental in shaping both the research direction and the system architecture of this project.
---
## ๐ License
ยฉ 2026 Devrajsinh Gohil & Jay Nasit. All Rights Reserved.