Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ JECRC Campus Assistant

Smart India Hackathon 2025 Project
Multilingual AI-powered campus chatbot for JECRC University

Python Flask License Deployment

🌟 Features

  • 🌐 Multilingual Support: Hindi, English, and regional languages
  • πŸ“± Responsive Design: Works perfectly on mobile and desktop
  • πŸ€– Smart Intent Recognition: Understands student queries naturally
  • ⚑ Real-time Responses: Instant answers to common questions
  • 🎨 Beautiful UI: Modern, accessible design with animations
  • πŸ”§ Easy Maintenance: Simple JSON-based knowledge base
  • πŸ“Š Analytics Ready: Built-in interaction logging
  • β™Ώ Accessible: Screen reader friendly with ARIA labels

🎯 Problem Statement

ID: 25104
Title: Language Agnostic Chatbot
Organization: Government of Rajasthan - Directorate of Technical Education (DTE)

Campus offices handle hundreds of repetitive queries daily. This chatbot:

  • βœ… Reduces administrative workload
  • βœ… Provides 24/7 student support
  • βœ… Breaks language barriers
  • βœ… Integrates with existing systems
  • βœ… Maintains conversation logs for improvement

πŸš€ Quick Start

Prerequisites

  • Python 3.11+ installed
  • Git installed
  • Modern web browser

Installation

  1. Clone the repository
git clone https://github.com/yourusername/campus-chatbot.git
cd campus-chatbot
  1. Create virtual environment
python -m venv chatbot_env

# Windows
chatbot_env\Scripts\activate

# macOS/Linux
source chatbot_env/bin/activate
  1. Install dependencies
pip install -r requirements.txt
  1. Run the application
python app.py
  1. Open browser
http://localhost:5000

πŸ§ͺ Testing

Test the chatbot with these queries:

  • fees β†’ Fee information
  • ΰ€«ΰ₯€ΰ€Έ β†’ Hindi fee information
  • admission β†’ Admission details
  • hostel β†’ Hostel information
  • placement β†’ Placement statistics

Run automated tests:

python -m pytest tests/ -v

🌐 Deployment

Option 1: Heroku (Free Tier Available)

  1. Install Heroku CLI
# Download from: https://devcenter.heroku.com/articles/heroku-cli
  1. Deploy to Heroku
# Login to Heroku
heroku login

# Create app
heroku create jecrc-campus-assistant

# Deploy
git add .
git commit -m "Deploy to Heroku"
git push heroku main

# Open app
heroku open

Option 2: Railway

  1. Connect to Railway
# Install Railway CLI
npm install -g @railway/cli

# Login and deploy
railway login
railway create
railway up

Option 3: Render

  1. Fork this repository
  2. Connect to Render.com
  3. Create new Web Service
  4. Connect your GitHub repo
  5. Deploy automatically

Option 4: Local Network Deployment

# Run on local network (accessible to all devices on WiFi)
python app.py

# Access from other devices using your IP:
# http://YOUR_IP_ADDRESS:5000

πŸ“š API Documentation

Endpoints

POST /chat

Send a message to the chatbot

Request:

{
  "message": "fees kya hai?"
}

Response:

{
  "response": "πŸ’° Fee Information:\nβ€’ B.Tech Fee: β‚Ή1,25,000/year...",
  "intent": "fees",
  "language": "hi",
  "status": "success"
}

GET /health

Check server health

Response:

{
  "status": "healthy",
  "intents": 12,
  "version": "1.0.0"
}

πŸŽ›οΈ Configuration

Adding New Responses

Edit knowledge_base.json:

{
  "new_topic": {
    "keywords": ["keyword1", "keyword2", "ΰ€Ήΰ€Ώΰ€‚ΰ€¦ΰ₯€_keyword"],
    "responses": {
      "hi": "Hindi response here",
      "en": "English response here"
    }
  }
}

Customizing UI

  • Colors: Edit static/css/styles.css
  • Content: Edit templates/index.html
  • Behavior: Edit static/js/script.js

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚    Flask App     β”‚    β”‚  Knowledge      β”‚
β”‚   (HTML/CSS/JS) │◄──►│   (Python)       │◄──►│  Base (JSON)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                        β”‚                        β”‚
        β–Ό                        β–Ό                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Interfaceβ”‚    β”‚ Intent Detection β”‚    β”‚   Responses     β”‚
β”‚   β€’ Chat Widget β”‚    β”‚ β€’ Language Detectβ”‚    β”‚   β€’ Hindi       β”‚
β”‚   β€’ Animations  β”‚    β”‚ β€’ Keyword Match  β”‚    β”‚   β€’ English     β”‚
β”‚   β€’ Responsive  β”‚    β”‚ β€’ Context Handle β”‚    β”‚   β€’ Multilingualβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Hackathon Demo Script

1. Problem Introduction (1 minute)

"Campus offices are overwhelmed with repetitive queries. Students struggle with language barriers. Our solution provides 24/7 multilingual support."

2. Live Demo (3 minutes)

  • Show beautiful UI loading
  • Demonstrate English query: "fees"
  • Demonstrate Hindi query: "ΰ€«ΰ₯€ΰ€Έ"
  • Show language switching
  • Test mobile responsiveness
  • Show admin panel (knowledge base editing)

3. Technical Highlights (1 minute)

  • "Built with Flask, modern JavaScript"
  • "JSON-based knowledge system for easy updates"
  • "Production-ready with proper error handling"
  • "Deployable in minutes"

πŸ“Š Impact & Metrics

Expected Benefits

  • 80% reduction in repetitive queries to admin staff
  • 24/7 availability for student support
  • Multi-language accessibility for diverse student body
  • Instant responses instead of long queues
  • Easy maintenance by student volunteers

Success Metrics

  • Query resolution rate: >90%
  • Response time: <2 seconds
  • User satisfaction: >4.5/5
  • Admin time saved: >20 hours/week

πŸ› οΈ Development

Adding New Features

  1. New Intent Recognition
# Add to detect_intent() function in app.py
if 'new_keyword' in message_lower:
    return 'new_intent'
  1. New UI Components
/* Add to static/css/styles.css */
.new-component {
    /* Your styles here */
}
  1. New Interactions
// Add to static/js/script.js
function newFeature() {
    // Your code here
}

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ† Team Credits

JECRC Foundation - SIH 2025 Team

  • Team Leader: [Your Name]
  • Frontend Developer: [Name]
  • Backend Developer: [Name]
  • UI/UX Designer: [Name]
  • Data Analyst: [Name]
  • Tester: [Name]

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

Common Issues

Q: Chatbot not responding?
A: Check if server is running and visit http://localhost:5000/health

Q: Hindi text not displaying properly?
A: Ensure UTF-8 encoding in your browser

Q: Mobile layout issues?
A: Clear browser cache and refresh

Q: Deployment failed?
A: Check all files are committed and requirements.txt is complete

Getting Help

πŸŽ‰ Acknowledgments

  • SIH 2025 for the opportunity
  • JECRC University for support
  • Government of Rajasthan for the problem statement
  • Flask Community for the excellent framework
  • Open Source Contributors for inspiration

Made with ❀️ for Smart India Hackathon 2025
Empowering students through technology

Windows Setup Commands Step 1: Open Command Prompt or PowerShell cmd# Open Command Prompt as Administrator (recommended)

Navigate to your desired project directory

cd C:\your-projects-folder Step 2: Create Project Directory cmdmkdir campus-chatbot cd campus-chatbot Step 3: Create Virtual Environment cmdpython -m venv venv Step 4: Activate Virtual Environment cmd# For Command Prompt venv\Scripts\activate

For PowerShell (if above doesn't work)

venv\Scripts\Activate.ps1 Step 5: Upgrade pip cmdpython -m pip install --upgrade pip Step 6: Install All Dependencies cmdpip install flask==2.3.3 pip install flask-cors==4.0.0 pip install chromadb==0.4.15 pip install sentence-transformers==2.2.2 pip install transformers==4.35.0 pip install torch==2.1.0 pip install PyPDF2==3.0.1 pip install pandas==2.1.3 pip install openpyxl==3.1.2 pip install python-docx==1.1.0 pip install nltk==3.8.1 pip install scikit-learn==1.3.2 pip install numpy==1.24.4 Step 7: Create Project Files cmd# Create main directories mkdir documents mkdir templates mkdir static

Create the main Python file

echo. > smart_rag_app.py

Create reset utility

echo. > reset_database.py

Create requirements file

pip freeze > requirements.txt

macOS/Linux Setup Commands Step 1: Open Terminal bash# Navigate to your desired project directory cd ~/your-projects-folder Step 2: Create Project Directory bashmkdir campus-chatbot cd campus-chatbot Step 3: Create Virtual Environment bashpython3 -m venv venv Step 4: Activate Virtual Environment bashsource venv/bin/activate Step 5: Upgrade pip bashpython -m pip install --upgrade pip Step 6: Install All Dependencies bashpip install flask==2.3.3 pip install flask-cors==4.0.0 pip install chromadb==0.4.15 pip install sentence-transformers==2.2.2 pip install transformers==4.35.0 pip install torch==2.1.0 pip install PyPDF2==3.0.1 pip install pandas==2.1.3 pip install openpyxl==3.1.2 pip install python-docx==1.1.0 pip install nltk==3.8.1 pip install scikit-learn==1.3.2 pip install numpy==1.24.4 Step 7: Create Project Structure bash# Create directories mkdir documents templates static

Create main files

touch smart_rag_app.py touch reset_database.py

Create requirements file

pip freeze > requirements.txt

Setting Up the Code Step 8: Add Your Code Files cmd# Copy your smart_rag_app.py content into the file

Use any text editor like notepad, VSCode, or vim

For Windows

notepad smart_rag_app.py

For macOS

open -a TextEdit smart_rag_app.py

For Linux

nano smart_rag_app.py Step 9: Create Reset Database Script Create reset_database.py with this content: cmd# For Windows notepad reset_database.py Add this code: pythonimport shutil import os

def reset_rag_system(): if os.path.exists("./advanced_jecrc_vectordb"): shutil.rmtree("./advanced_jecrc_vectordb") print("βœ… Removed vector database")

if os.path.exists("document_cache.pkl"):
    os.remove("document_cache.pkl")
    print("βœ… Removed document cache")

print("πŸ”„ Database reset complete!")

if name == "main": reset_rag_system() Step 10: Add Your Documents cmd# Copy your PDF and Excel files to the documents folder

Windows

copy "C:\path\to\your\documents*" documents\

macOS/Linux

cp /path/to/your/documents/* documents/

First Run Commands Step 11: Initial Setup Run cmd# Make sure virtual environment is activated

Windows

venv\Scripts\activate

macOS/Linux

source venv/bin/activate

Run the application for first time

python smart_rag_app.py You should see output like: πŸš€ Initializing Advanced Smart RAG System... πŸ“₯ Loading advanced embedding model... 🧠 Loading free QA model... βœ… QA model loaded successfully πŸ“š Loading enhanced JECRC documents... βœ… Successfully loaded documents

Troubleshooting Commands If Models Don't Download: cmd# Check internet connection ping google.com

Clear pip cache

pip cache purge

Reinstall sentence-transformers

pip uninstall sentence-transformers pip install sentence-transformers If Database Issues Occur: cmd# Stop the application (Ctrl+C)

Reset database

python reset_database.py

Restart application

python smart_rag_app.py If Import Errors: cmd# Check what's installed pip list

Reinstall specific package

pip uninstall package-name pip install package-name If Port Already in Use: cmd# Windows - Find process using port 5000 netstat -ano | findstr :5000

Kill the process (replace PID with actual number)

taskkill /PID 1234 /F

macOS/Linux - Find and kill process

lsof -ti:5000 | xargs kill -9

Daily Operation Commands Starting the Application: cmd# Navigate to project cd campus-chatbot

Activate environment

Windows

venv\Scripts\activate

macOS/Linux

source venv/bin/activate

Run application

python smart_rag_app.py Stopping the Application: cmd# Press Ctrl+C in the terminal running the app Adding New Documents: cmd# Copy new documents to folder

Windows

copy "C:\new\documents*" documents\

Restart application to load new documents

python smart_rag_app.py Updating Dependencies: cmdpip install --upgrade flask chromadb sentence-transformers

Complete Setup Verification Run these commands to verify everything works: cmd# 1. Check Python version python --version

2. Check if virtual environment is active

(you should see (venv) in your command prompt)

3. Test imports

python -c "import flask, chromadb, sentence_transformers; print('All imports successful')"

4. Check documents folder

Windows

dir documents

macOS/Linux

ls -la documents/

5. Run application

python smart_rag_app.py Expected Final Output: πŸ“ Found X documents to process... βœ… πŸ“Œ Loaded PDF: CURRENT_Syllabus-CSE-5-6.pdf (12 chunks, Priority: high) βœ… πŸ“Š Loaded Excel: CURRENT_2023-2024.xlsx (6 chunks, Priority: high) βœ… Successfully loaded X documents from Y files

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages