Skip to content

SHALINISAURAV/AI-Study-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

███████╗████████╗██╗   ██╗██████╗ ██╗   ██╗
██╔════╝╚══██╔══╝██║   ██║██╔══██╗╚██╗ ██╔╝
███████╗   ██║   ██║   ██║██║  ██║ ╚████╔╝ 
╚════██║   ██║   ██║   ██║██║  ██║  ╚██╔╝  
███████║   ██║   ╚██████╔╝██████╔╝   ██║   
╚══════╝   ╚═╝    ╚═════╝ ╚═════╝    ╚═╝   
        A S S I S T A N T   🎓            
Typing SVG

Live Demo Python Streamlit Groq SQLite


"What if you had a personal tutor who knew every subject, never got tired, and adapted to how YOU learn?" Meet your AI Study Assistant.


📖 What Is This?

A full-stack AI-powered study companion built for students, self-learners, and curious minds. It doesn't just answer questions — it adapts to your level, summarizes your PDFs, stores your learning history, and exports your notes.

Think ChatGPT — but laser-focused on helping you actually learn and retain knowledge.


✨ Everything It Can Do

🔐 Authentication System Full login & signup with SQLite. Session persistence so you never lose your progress. Optional "Remember Me" support.

💬 Chat-Based Learning Ask anything, get intelligent answers in a clean ChatGPT-style interface. Subject-aware responses that adapt to context.

📄 PDF Summarization Upload any study material. AI extracts the text, understands it, and gives you a clean, concise summary.

📥 Download Notes as PDF Every AI response can be exported as a formatted PDF — ready to print, share, or revise from.

📜 Chat History Every question and answer is saved. Review your learning journey, revisit past explanations, or clear and start fresh.

🌙 Dark Mode Toggle between light and dark themes. Study comfortably at 2am without burning your eyes.


🧠 3 Study Modes — One Assistant

┌─────────────────────────────────────────────────────────────────┐
│                                                                 │
│   📘  BEGINNER MODE                                             │
│       Simple language · Analogies · Step-by-step breakdown      │
│       "Explain it like I'm hearing this for the first time"     │
│                                                                 │
│   📗  NORMAL MODE                                               │
│       Detailed explanations · Examples · Full context           │
│       "Give me a thorough, complete understanding"              │
│                                                                 │
│   📕  EXAM REVISION MODE                                        │
│       Bullet points · Key facts · Quick recall format           │
│       "I have 2 hours before my exam, let's go"                 │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

🤖 Subject-Aware AI

The assistant doesn't give generic answers — it adapts its style to the subject:

Subject How It Responds
➕ Math Step-by-step solving with working shown
💻 Programming Code examples + line-by-line explanation
🔬 Science Real-world analogies + visual descriptions
📚 General Structured explanation with examples

🏗️ How It Works

  User logs in / signs up
          │
          ▼
  ┌───────────────────┐       ┌─────────────────────┐
  │  Ask a question   │  OR   │   Upload a PDF       │
  └────────┬──────────┘       └──────────┬──────────┘
           │                             │
           ▼                             ▼
  ┌────────────────────────────────────────────────┐
  │               prompts.py                       │
  │  Subject + Mode → Crafted System Prompt        │
  └─────────────────────┬──────────────────────────┘
                        │
                        ▼
  ┌────────────────────────────────────────────────┐
  │            Groq API ⚡ (LLM)                   │
  │         Fast inference, smart output           │
  └─────────────────────┬──────────────────────────┘
                        │
          ┌─────────────┼──────────────┐
          ▼             ▼              ▼
    Chat display   Save to DB    Export as PDF
                  (SQLite)      (ReportLab)

🗄️ Database Schema

-- Users table
CREATE TABLE users (
    id        INTEGER PRIMARY KEY AUTOINCREMENT,
    username  TEXT UNIQUE NOT NULL,
    password  TEXT NOT NULL
);

-- Chat history table
CREATE TABLE history (
    id        INTEGER PRIMARY KEY AUTOINCREMENT,
    username  TEXT,
    question  TEXT,
    answer    TEXT,
    timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
);

📂 Project Structure

ai-study-assistant/
│
├── 📄 app.py               ← main streamlit app + UI + routing
├── 📄 db.py                ← all SQLite database functions
├── 📄 prompts.py           ← subject + mode based prompt builder
│
├── 📄 study.db             ← SQLite database (auto-created)
├── 📄 notes.pdf            ← latest exported notes
├── 📄 session.txt          ← login session persistence
│
├── 📄 requirements.txt     ← all dependencies
└── 📄 .env                 ← GROQ_API_KEY (never push this!)

🚀 Run Locally

# 1. Clone the repo
git clone https://github.com/SHALINISAURAV/ai-study-assistant.git
cd ai-study-assistant

# 2. Create virtual environment
python -m venv venv
source venv/bin/activate       # Mac/Linux
# venv\Scripts\activate        # Windows

# 3. Install dependencies
pip install -r requirements.txt

# 4. Add your API key
echo "GROQ_API_KEY=your_api_key_here" > .env

# 5. Launch 🚀
streamlit run app.py

🔑 Get your free Groq API key → console.groq.com


🔐 Environment Variables

GROQ_API_KEY=your_groq_api_key_here

For Streamlit Cloud → Settings → Secrets mein add karo.


📦 Requirements

streamlit
groq
python-dotenv
PyPDF2
reportlab
pillow
requests

🗺️ Roadmap

  • 🔐 Login & Signup with SQLite
  • 💬 Chat-based AI tutor
  • 🧠 3 adaptive study modes
  • 📄 PDF upload & summarization
  • 📥 Download notes as PDF
  • 📜 Chat history storage
  • 🌙 Dark mode toggle
  • ⚡ Groq LLM integration

👩‍💻 Author

Shalini Saurav

AI Engineer · Data Scientist · Builder

Building tools that make learning faster, smarter, and more accessible.

GitHub


⭐ If this made studying easier for you — star it!

Try Live Demo


"The smartest thing you can do is make learning easier for yourself."

About

AI Study Assistant is a Streamlit-based AI-powered learning app that helps users get instant explanations, summaries, and answers using Groq API. It supports multi-user login, PDF summarization, voice input, and chat history storage. Designed for students to study smarter with interactive and personalized AI assistance.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages