StudyMate is a Streamlit-based AI assistant that helps you study and research efficiently.
It allows you to upload PDF documents, extract text, split it into chunks, perform semantic search,
and get concise AI-generated answers using OpenAI or Hugging Face models
- 📥 Upload PDFs – Supports multiple PDFs at once.
- 📄 Text Extraction – Extracts searchable text from PDFs (supports scanned PDFs with future OCR integration).
- ✂ Chunking – Splits text into overlapping chunks for better semantic search.
- 🔎 Semantic Search – Uses Sentence Transformers for embeddings and optional FAISS for fast similarity search.
- 🤖 AI-Powered Answers – Generates concise, context-based answers from:
- OpenAI Chat models (e.g.,
gpt-3.5-turbo) - Hugging Face Inference API (e.g.,
Mistral-7B-Instruct)
- OpenAI Chat models (e.g.,
- 📚 Source References – Always provides document/chunk IDs in the answer
git clone https://github.com/YOUR_USERNAME/studymate.git
cd studymatepython -m venv venv
# Activate it:
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activatepip install -r requirements.txtIf you don’t have a requirements.txt yet, create one with:
streamlit
python-dotenv
PyMuPDF
numpy
sentence-transformers
faiss-cpu
openai
requestsCreate a .env file in the root of your project:
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
HUGGINGFACE_API_KEY=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_MODEL=gpt-3.5-turbo
HUGGINGFACE_MODEL=mistralai/Mistral-7B-Instruct-v0.2⚠ Important: Never commit your .env file to GitHub. Add it to .gitignore:
.envOnce your .env is set up and dependencies are installed, run:
streamlit run app.pyOpen your browser at the URL shown in the terminal (usually http://localhost:8501).
StudyMate/
│
├── app.py # Main Streamlit app
├── requirements.txt # Python dependencies
├── .env # API keys and config (not tracked in Git)
└── README.md # Project documentation
- Upload PDFs – Select one or more PDF files.
- Extract Text – Click "Read text from PDFs".
- Chunk Text – Adjust chunk size/overlap, then "Create Chunks".
- Build Index – Click "Build Semantic Index" for embeddings.
- Ask Questions – Type your question and choose your AI provider.
- View Answer – See AI-generated answers with source references.
If FAISS isn’t available, NumPy fallback is used.
To install FAISS CPU version:
pip install faiss-cpuThis project is licensed under the MIT License – see the LICENSE file for details.