Skip to content

GaneshDoosa/swavalambi-ai

Repository files navigation

Swavalambi β€” AI-Powered Platform for Skilled Workers

Swavalambi helps Indian artisans and skilled workers find jobs, access government schemes/loans, and validate their skills using AI.

Built for the AWS AI for Bharat Hackathon by Team Algonauts.


Features

  • πŸ€– AI Profiling Chat β€” Conversational agent (Claude via Bedrock/Anthropic) collects skill, intent, experience, and preferred job location
  • πŸ“Έ Vision Skill Assessment β€” Upload a work photo; AI scores it and saves a skill_rating to your profile
  • πŸ’Ό Personalised Job Search β€” Filtered by skill + preferred city/state via NCS (National Career Service) API
  • πŸ“š Training Centers β€” Matched by skill using live Skill India API with local JSON fallback
  • πŸ›οΈ Government Schemes β€” Searched via myScheme.gov.in API
  • πŸ” Dual Authentication β€” Email/password (Cognito) or OTP (mock, for testing)
  • 🌐 Voice Support β€” Hindi voice input/output with AWS Transcribe / Polly / Sarvam AI
  • 🎯 Personalized Greeting β€” AI addresses user by name and skips asking for it if already known
  • πŸ”’ Skill-gated Access β€” Application buttons locked below Level 3 skill rating

Project Structure

swavalmbi-ai/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ profiling_agent.py     # AI chat β€” collects skill, intent, location
β”‚   β”‚   └── vision_agent.py        # Score work sample photos
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ routes_auth.py         # Register, login, OTP, Cognito
β”‚   β”‚   β”œβ”€β”€ routes_chat.py         # POST /chat/chat-profile
β”‚   β”‚   β”œβ”€β”€ routes_users.py        # User CRUD + delete from DynamoDB & Cognito
β”‚   β”‚   β”œβ”€β”€ routes_recommendations.py  # Jobs, schemes, training centers
β”‚   β”‚   β”œβ”€β”€ routes_vision.py       # Photo skill assessment
β”‚   β”‚   └── routes_voice.py        # Voice transcription / synthesis
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ dynamodb_service.py    # DynamoDB CRUD helpers
β”‚   β”‚   β”œβ”€β”€ cognito_service.py     # Cognito register / login / admin delete
β”‚   β”‚   └── live_data.py           # NCS jobs, myScheme, SkillIndia APIs
β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   └── models.py              # Pydantic request/response models
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   └── upskill-agent/
β”‚   β”‚       └── skill_india_training_centers.json  # Local fallback (~25MB)
β”‚   └── scripts/
β”‚       β”œβ”€β”€ setup_dynamodb.py
β”‚       β”œβ”€β”€ setup_cognito.py
β”‚       └── setup_voice_services.py
└── frontend/
    └── src/pages/
        β”œβ”€β”€ Login.tsx       # OTP + email/password auth
        β”œβ”€β”€ Register.tsx    # Email/password registration
        β”œβ”€β”€ Home.tsx        # Dashboard + recommendations
        β”œβ”€β”€ Assistant.tsx   # AI chat interface
        β”œβ”€β”€ Upskill.tsx     # Training center listings
        β”œβ”€β”€ Schemes.tsx     # Government scheme listings
        └── Profile.tsx     # User profile + skill level

Prerequisites

  • Python 3.10+ (conda env: ai4bharat)
  • Node.js 18+ & npm
  • AWS credentials with access to:
    • Amazon Bedrock (Claude Sonnet β€” ProfilingAgent + VisionAgent)
    • Amazon DynamoDB (us-east-1)
    • Amazon Cognito (User Pools β€” email/password auth)
    • Amazon S3 (voice audio files)
    • Amazon Transcribe, Polly, Translate (voice features)

First-Time Setup

1. Create AWS Resources

cd backend
conda activate ai4bharat

python scripts/setup_dynamodb.py      # Creates swavalambi_users table
python scripts/setup_cognito.py       # Creates Cognito User Pool + Client
python scripts/setup_voice_services.py  # Creates S3 bucket

⚠️ If your AWS session token has expired, run aws sso login first.

2. Configure backend/.env

# AWS
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
AWS_SESSION_TOKEN=...        # optional β€” only if using SSO/temporary credentials
AWS_DEFAULT_REGION=us-east-1

# DynamoDB
DYNAMODB_TABLE=swavalambi_users

# Cognito (from setup_cognito.py output)
COGNITO_USER_POOL_ID=us-east-1_XXXXXXXXX
COGNITO_CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxx

# LLM β€” pick one
USE_ANTHROPIC=true
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MODEL_ID=claude-3-5-sonnet-latest

# or Bedrock
USE_ANTHROPIC=false
BEDROCK_MODEL_ID=global.anthropic.claude-sonnet-4-5-20250929-v1:0

# Voice (optional)
VOICE_PROVIDER=aws
AWS_S3_BUCKET=swavalambi-voice
AWS_POLLY_VOICE_ID=Aditi

Running Locally

Backend

cd backend
conda activate ai4bharat
pip install -r requirements.txt   # first time only
python -m uvicorn main:app --reload --port 8000

Swagger UI β†’ http://localhost:8000/docs

Frontend

cd frontend
npm install       # first time only
npm run dev

App β†’ http://localhost:3000


API Endpoints

Authentication

Method Path Description
POST /api/auth/register Register with email + password β†’ verification email sent
POST /api/auth/verify-email Confirm email with 6-digit code
POST /api/auth/login Login with email + password β†’ JWT tokens
POST /api/auth/resend-code Resend verification code
POST /api/auth/forgot-password Start password reset
POST /api/auth/reset-password Confirm reset with code
POST /api/auth/send-otp Legacy OTP send (mock 123456, testing only)
POST /api/auth/verify-otp Legacy OTP verify (testing only)

User Management

Method Path Description
POST /api/users/register Upsert user profile in DynamoDB
GET /api/users/{user_id} Fetch user profile
DELETE /api/users/{user_id}?email=... Delete from DynamoDB + Cognito
GET /api/users/{user_id}/chat-history Fetch chat history
DELETE /api/users/{user_id}/chat-history Clear chat history

AI Services

Method Path Description
POST /api/chat/chat-profile Profiling conversation β€” collects skill, intent, location
POST /api/vision/analyze-vision Score work sample photo
POST /api/recommendations/fetch Jobs / schemes / training centers (location-filtered)

Voice Services

Method Path Description
POST /api/voice/transcribe Audio β†’ text (Transcribe / Sarvam)
POST /api/voice/synthesize Text β†’ speech (Polly / Sarvam)
POST /api/voice/translate Translate text

Health

Method Path Description
GET /health Health check

User Flow

Register (email + password)  β†’  Verify email
    ↓
Login  β†’  Dashboard
    ↓
AI Chat Assistant:
  1. Greets by name (already known from DB)
  2. Asks profession/skill
  3. Asks intent: Job / Upskill / Loan
  4. If Job β†’ asks preferred city/state
  5. Assesses experience (beginner / intermediate / advanced)
  6. If intermediate/advanced β†’ asks to upload work photo
    ↓
Vision Agent scores photo  β†’  skill_rating saved to DynamoDB
    ↓
Dashboard shows personalised:
  - Jobs (filtered by skill + location via NCS)
  - Government Schemes (via myScheme.gov.in)
  - Training Centers (live Skill India API + local JSON fallback)

Skill Lock Logic

Skill Rating Access
< 3 (Beginner) View-only β€” apply buttons locked
β‰₯ 3 (Intermediate/Advanced) Full access β€” can apply for jobs, loans, schemes

Deleting a Test User

To fully reset a user (remove from both DynamoDB and Cognito):

# Via curl
curl -X DELETE "http://localhost:8000/api/users/9898989898?email=test@example.com"

# Or open Swagger UI β†’ DELETE /api/users/{user_id}

Recommendation Data Sources

Data Type Source Fallback
Jobs NCS API (filtered by skill + location) None
Schemes myScheme.gov.in API None
Training Centers Skill India Digital Hub API Local JSON (data/upskill-agent/)

The local JSON fallback is used when the live Skill India API returns no skill-matched centers (e.g. for "Plumber", the JSON has "Plumber - General" courses).


Tech Stack

Layer Technology
Frontend React 18, Vite, TypeScript, Vanilla CSS
Backend FastAPI, Python 3.10+, Uvicorn
AI Agents AWS Bedrock / Anthropic Claude (Strands Agents SDK)
Authentication AWS Cognito (User Pools, JWT)
Database Amazon DynamoDB (swavalambi_users)
Voice AWS Transcribe + Polly + Translate / Sarvam AI
Storage Amazon S3
Jobs API NCS β€” National Career Service
Schemes API myScheme.gov.in
Training API Skill India Digital Hub + local JSON fallback

About

AI-powered platform helping Indian skilled workers find jobs, access schemes, and validate skills using voice and vision AI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors