Skip to content

Fully local and open-source AI study companion for lecture PDFs - with slide summarization, smart Q&A, and flashcard creation using LangChain and Hugging Face Transformers.

License

Notifications You must be signed in to change notification settings

d-senyaka/mentor-maximus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 AI Study Assistant

An AI-powered study companion that helps students understand lecture material through intelligent question answering, slide summarization, PDF summaries, and flashcard generation. Built with LangChain, Hugging Face Transformers, and Gradio β€” and fully powered by open-source LLMs running on your local GPU.


πŸš€ Features

πŸ“„ Upload Lecture PDFs

Drag and drop any academic or lecture PDF β€” slides or notes.

❓ Ask Questions from Slides

Use natural language to ask:

  • β€œSummarize Slide 4”
  • β€œWhat is Linear Regression?”
  • β€œWhat is covered under Artificial Neural Networks?”

Supports fuzzy slide matching and page number detection.

🧠 Full PDF Summarizer

Click one button to get a concise overview of the entire document.

πŸ“ Flashcard Generator

Automatically generates Q&A-style flashcards from your material β€” perfect for revision and quizzes.

🧩 Slide Number Matching (Fuzzy Logic)

Queries like "Summarize Slide 5" are matched against actual page content using fuzzy logic for accurate results.


image Screenshot 2025-06-19 181347 Screenshot 2025-06-19 181559


πŸ›  Tech Stack

Layer Tools Used
Frontend Gradio (Python UI)
LLM Hugging Face Transformers (Phi-2 / Mistral 7B / Falcon)
Framework LangChain
Vector DB FAISS
PDF Parsing PyMuPDF (via LangChain loaders)
Embeddings SentenceTransformers (MiniLM-L6-v2)
Fuzzy Matching RapidFuzz

πŸ“ Project Structure

ai_tutor/
β”œβ”€β”€ app.py
β”œβ”€β”€ ui/
β”‚   └── interface.py
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ document_loader.py
β”‚   β”œβ”€β”€ vector_store.py
β”‚   β”œβ”€β”€ rag_pipeline.py
β”‚   β”œβ”€β”€ llm_interface.py
β”‚   β”œβ”€β”€ slide_mapper.py
β”‚   β”œβ”€β”€ summarizer.py
β”‚   └── flashcards.py
β”œβ”€β”€ data/
β”‚   └── (your PDFs here)
β”œβ”€β”€ requirements.txt
└── README.md

βš™οΈ Setup Instructions

1. Clone the repository

git clone https://github.com/your-username/ai-study-assistant.git
cd ai-study-assistant

2. Create a virtual environment

python -m venv venv
source venv/bin/activate   # or venv\Scripts\activate on Windows

3. Install dependencies

pip install -r requirements.txt

4. Run the app

python -m ui.interface

πŸ’‘ Example Questions

  • β€œSummarize Slide 3”
  • β€œWhat is supervised learning?”
  • β€œWhat is covered on page 10?”
  • β€œGenerate flashcards for the regression topic”
  • β€œGive a summary of this entire PDF”

πŸ“¦ Models Tested

  • microsoft/phi-2 βœ… (recommended for speed and accuracy)
  • mistralai/Mistral-7B-Instruct-v0.1 βœ…
  • tiiuae/falcon-rw-1b βœ… (lightweight)

You can switch models in llm_interface.py


πŸ” Local & Private

This project runs entirely offline on your own PC β€” no API keys or cloud calls required. Perfect for privacy and local LLM experimentation.


🧠 Skills Used

  • LangChain chains and document loaders
  • RAG (Retrieval-Augmented Generation) pipeline
  • LLM fine-tuned prompting
  • Embedding & similarity search with FAISS
  • PDF text extraction using PyMuPDF
  • RapidFuzz for slide number matching
  • Gradio UI design

πŸ‘¨β€πŸŽ“ Author

Deshan Senanayake
BSc (Hons) Artificial Intelligence & Data Science
Robert Gordon University (via IIT, Sri Lanka)


Issues

Feel free to add any issues you find.


🏁 Future Work

  • Export flashcards as .csv or .txt
  • Add MCQ quiz generator
  • Add feedback loop to improve flashcards
  • Deploy to HuggingFace Spaces or Streamlit Cloud
  • Voice input (Whisper integration)

πŸ“œ License

MIT License – free to use, modify, and share with credit.

About

Fully local and open-source AI study companion for lecture PDFs - with slide summarization, smart Q&A, and flashcard creation using LangChain and Hugging Face Transformers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages