Spaces:
Running
Running
metadata
title: JanSahayak
emoji: ๐
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
๐ JanSahayak - AI-Powered Government Schemes & Exams Assistant
Your personal AI assistant for discovering government schemes and competitive exam opportunities in India
๐ Features
๐ค Multi-Agent AI System
- Profiling Agent: Extracts structured user information
- Scheme Agent: Recommends relevant government schemes
- Exam Agent: Suggests competitive exams based on qualifications
- RAG Agent: Retrieves information from curated document database
๐ก Intelligent Capabilities
- โ Natural language understanding of user profiles
- โ Smart recommendations based on eligibility criteria
- โ RAG (Retrieval-Augmented Generation) with FAISS vectorstore
- โ Real-time web search via Tavily API
- โ PDF generation for saving recommendations
- โ Beautiful web interface with modern UI
๐ Deploy to Hugging Face Spaces (Recommended)
Why Hugging Face Spaces?
- โ 16GB RAM for FREE (perfect for RAG apps!)
- โ Built for ML/AI applications
- โ Git-based deployment
- โ Public URL instantly
- โ Persistent storage
Quick Deploy Steps:
Method 1: Using HF CLI (Easiest)
# Install HF CLI
pip install huggingface_hub[cli]
# Login
huggingface-cli login
# Create Space and push
huggingface-cli repo create jansahayak --type space --space_sdk gradio
git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/jansahayak
git push hf main
Method 2: Manual Setup
Create Space on huggingface.co/spaces
- Click "Create new Space"
- Name:
jansahayak - SDK: Select "Gradio" (works with Flask)
- Hardware: CPU basic (Free - 16GB RAM!)
- License: MIT
Clone YOUR Space repo (not GitHub!)
git clone https://huggingface.co/spaces/YOUR_USERNAME/jansahayak cd jansahayakCopy your project files
# Copy all files from your JanSahayak folder to the cloned space folder cp -r /path/to/JanSahayak/* .Add Environment Variables (Space Settings โ Variables and secrets)
GROQ_API_KEY=your_groq_key TAVILY_API_KEY=your_tavily_key HF_TOKEN=your_hf_token (optional) SKIP_VECTORSTORES=falsePush to Space
git add . git commit -m "Initial commit" git push
Your app will be live at: https://huggingface.co/spaces/YOUR_USERNAME/jansahayak
Important Notes:
- HF Spaces uses its own Git repo (not GitHub directly)
- App runs on port 7860 by default (Flask uses 5000, update if needed)
- First deployment may take 5-10 minutes to install dependencies
- Check Space logs if deployment fails
๐ ๏ธ Local Development
# Clone and setup
git clone https://github.com/YOUR_USERNAME/JanSahayak.git
cd JanSahayak
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/Mac
.venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Configure API keys
cp .env.example .env
# Edit .env with your keys
# Build vectorstores (optional - if you have PDFs)
python init_embeddings.py
# Run app
python app.py
# or use launcher scripts: start_web.bat (Windows) / ./start_web.sh (Linux/Mac)
Visit http://localhost:5000
๐ Get API Keys
| Service | URL | Free Tier | Used For |
|---|---|---|---|
| Groq | console.groq.com | โ Yes | LLM Inference |
| Tavily | tavily.com | 1000 searches/mo | Web Search |
| HuggingFace | huggingface.co/settings/tokens | โ Yes | Model Downloads |
๐พ Adding Custom Documents
Government Schemes PDFs
- Place PDFs in
data/schemes_pdfs/ - Run
python init_embeddings.py - Restart app
Exam Information PDFs
- Place PDFs in
data/exams_pdfs/ - Run
python init_embeddings.py - Restart app
Automatically indexed and searchable via RAG!
๐งช Technology Stack
- Backend: Flask
- AI: LangChain + LangGraph
- LLM: Groq (Llama 3.3 70B)
- Embeddings: sentence-transformers/all-MiniLM-L6-v2
- Vector DB: FAISS (local)
- Search: Tavily API
- Frontend: HTML5 + CSS3 + JavaScript
๐ Project Structure
JanSahayak/
โโโ app.py # Flask web app
โโโ main.py # CLI interface
โโโ agents/ # AI agents
โ โโโ profiling_agent.py
โ โโโ scheme_agent.py
โ โโโ exam_agent.py
โ โโโ rag_agent.py
โโโ rag/ # RAG components
โ โโโ embeddings.py
โ โโโ scheme_vectorstore.py
โ โโโ exam_vectorstore.py
โโโ data/ # Documents
โ โโโ schemes_pdfs/
โ โโโ exams_pdfs/
โโโ templates/ # HTML templates
โโโ static/ # CSS/JS
๐ Troubleshooting
Memory issues on local machine?
# Set in .env
SKIP_VECTORSTORES=true
Uses web search only (no embeddings needed)
Vectorstore errors?
rm -rf rag/scheme_index rag/exam_index
python init_embeddings.py
๐ค Contributing
Contributions welcome! Fork โ Create branch โ Submit PR
๐ License
MIT License
๐ Acknowledgments
Built with LangChain, Groq, Tavily, and โค๏ธ
Made for the people of India ๐ฎ๐ณ