Skip to content

Abhay2030/ScholarBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

114 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScholarBot 🎓🤖 An Elite Multimodal AI Engineering Tutor

ScholarBot is a highly specialized, AI-powered educational platform designed specifically for engineering students. Built with Python, Flask, and Google's Gemini 2.5 Flash, it provides adaptive, multimodal tutoring—allowing users to ask complex engineering questions, upload diagrams, or draw directly on a virtual whiteboard for real-time AI analysis.

Featuring real-time database synchronization via Firebase Firestore, secure authentication, and a responsive glassmorphism UI, ScholarBot operates as a fully-fledged SaaS prototype.

✨ Key Features 🧠 Multimodal AI Engine: Powered by gemini-2.5-flash, capable of processing both text and complex engineering diagrams.

🎨 Interactive Whiteboard: Built-in HTML5 Canvas integration. Users can draw circuit diagrams, logic gates, or free-body diagrams and instantly send them to the AI for analysis.

🎭 Adaptive Personas: Context-aware AI behavior switching between:

Professor Mode: Deep, rigorous, university-level explanations.

Explain Like I'm 5 (ELI5): Simplified analogies for complex topics.

Code Reviewer: Strict, optimized debugging and architectural feedback.

🤝 Real-Time Group Study: Shared chat sessions synchronized instantly via Firebase Firestore, allowing multiple students to interact with the same AI thread.

🎙️ Voice Interaction: Integrated Web Speech API for speech-to-text querying and text-to-speech AI responses.

📄 PDF Export: One-click generation of beautifully formatted study notes using html2pdf.js.

💻 Developer-Focused UI: Custom OLED-dark mode interface with glassmorphism effects, mobile responsiveness, and built-in syntax highlighting (Prism.js) with one-click code copying.

🛠️ Tech Stack Backend Python 3.10 & Flask: Lightweight, robust routing and API management.

Google GenAI SDK: Direct integration with the Gemini 2.5 Flash model for lightning-fast, multimodal inference.

Gunicorn: Production-grade WSGI HTTP server for concurrent request handling.

Docker: Fully containerized for seamless deployment to Google Cloud Run.

Frontend HTML5 / CSS3 / Vanilla JS: Zero-framework, highly optimized frontend for maximum performance.

Firebase Authentication: Secure Google OAuth login.

Firebase Firestore: NoSQL real-time database for storing user profiles, chat histories, and shared group sessions.

Libraries: marked.js (Markdown parsing), Prism.js (Syntax highlighting), html2pdf.js (PDF generation).

🏗️ Architecture & System Flow Authentication: Users authenticate via Firebase Google Sign-In. The client maintains the session state.

Context Construction: The frontend packages the user's prompt, uploaded/drawn Base64 image data, university/branch context, and the selected "Persona" into a JSON payload.

Stateless AI Processing: The Flask backend receives the payload, constructs a dynamic prompt overriding system instructions based on the persona, and streams the request to the Gemini API.

Real-Time Sync: As the bot replies, the frontend renders the Markdown locally and asynchronously commits the transaction to Firestore, updating the UI instantly across all devices in a shared session.

🚀 Getting Started Prerequisites Python 3.10+

Docker (Optional, for containerized deployment)

A Google Gemini API Key

A Firebase Project with Auth and Firestore enabled

Local Installation Clone the repository

Bash git clone https://github.com/yourusername/scholarbot.git cd scholarbot Set up a virtual environment

Bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate Install dependencies

Bash pip install -r requirements.txt Environment Variables Create a .env file in the root directory and add your Gemini API Key:

Code snippet GEMINI_API_KEY=your_google_gemini_api_key_here Run the Flask App

Bash python app.py The app will be available at http://localhost:8080

Docker Deployment To build and run the application using Docker:

Bash docker build -t scholarbot . docker run -p 8080:8080 -e GEMINI_API_KEY="your_api_key" scholarbot 🗺️ Roadmap & Future Enhancements Backend Security Hardening: Migrate Firebase token validation to the Flask backend to protect the /ask route from unauthorized API consumption.

Stateless Memory Management: Transition from server-side memory dictionaries to passing rolling Firestore chat histories to the Gemini API to fully support serverless horizontal scaling.

Payment Gateway Integration: Implement backend webhooks for Razorpay to securely manage the Pro tier subscription lifecycle.

Payload Optimization: Add client-side canvas compression for whiteboard drawings to reduce Base64 payload sizes and decrease latency.

👨‍💻 Author Abhay Donde

Role: Full Stack Developer / Creator

Portfolio: View My Work

📄 License This project is proprietary and developed by Abhay Donde. All rights reserved.

About

An elite, multimodal AI engineering tutor built with Google Gemini 2.5 Flash, Flask, and Firebase. Features an interactive whiteboard, real-time group study sessions, and adaptive AI learning personas.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors