A lightweight AI-powered study support tool that helps students learn more effectively from their class transcripts and notes. Built with Streamlit and powered by Google's Gemini AI.
- 📖 Interactive Q&A: Ask questions about your course materials and get AI-powered answers
- 📝 Exam Mode: Take practice exams with varied question types (multiple choice, fill-in-the-blank, true/false, select all)
- ⚡ Smart Flashcards: Auto-generate flashcards from course content with intelligent caching
- 💾 Caching System: Saves generated flashcards to avoid redundant API calls
- 📁 Multi-Course Support: Organize materials by courses and lessons
- 🎯 Context-Aware: AI responses are strictly based on your provided course materials
- Python 3.8 or higher
- Google Gemini API key (Get one here)
-
Clone or download this repository
git clone <repository-url> cd Study-assistant
-
Install dependencies
pip install -r requirements.txt
-
Set up your API key
Create a
.envfile in the root directory:touch .env
Add your Gemini API key to the
.envfile:GOOGLE_API_KEY=your_gemini_api_key_here⚠️ Important: Never commit your.envfile to version control. It's already included in.gitignore. -
Add your course materials
Follow the structure in
Courses/Example-Course/:Courses/ ├── Your-Course-Name/ │ ├── Lesson-1/ │ │ ├── lecture_notes.txt │ │ └── readings.txt │ ├── Lesson-2/ │ │ └── content.txt │ └── ... -
Run the application
streamlit run app.py
-
Start studying!
- Select your course and lesson from the sidebar
- Click "Load Materials"
- Choose your study mode: Q&A, Exam, or Flashcards
Courses/
├── README.md # Guidelines for organizing courses
├── Example-Course/ # Sample course (included)
│ └── Lesson-1/
│ └── sample_content.txt
└── Your-Course/ # Your course materials
├── Week-1/
│ ├── lecture_transcript.txt
│ └── readings.txt
└── Week-2/
└── notes.txt
- Format: Use
.txtfiles only (UTF-8 encoded) - Organization: Create folders for each course, then subfolders for lessons/weeks
- Content: Include lecture transcripts, notes, readings, or any study materials
- Naming: Use consistent naming conventions (e.g., "Week-1", "Chapter-2", "Lesson-3")
- Ask questions about your course materials
- Get contextual answers based only on your content
- Perfect for clarifying concepts and reviewing material
- Take AI-generated practice exams
- Multiple question types: multiple choice, true/false, fill-in-the-blank, select all
- Immediate feedback with explanations
- Questions are based strictly on your course content
- Auto-generate flashcards from course materials
- Navigate with Previous/Next buttons
- Show/hide answers for active recall practice
- Cached for fast loading on repeat visits
The app supports both environment variable names:
GOOGLE_API_KEY(recommended)GEMINI_API_KEY(legacy support)
- Default model:
gemini-2.5-pro - Optimized for educational content and question generation
- Configured for reliable JSON output for flashcards
- Flashcards are automatically cached in
data/flashcard_cache/ - Reduces API costs and improves performance
- Cache files are course and lesson-specific
- All course materials remain local
- Only processed content is sent to Gemini API for generating responses
- No personal data is stored or transmitted beyond what's necessary for AI responses
- Streamlit: Web application framework
- Google Gemini: AI model for content understanding and generation
- Python 3.8+: Core programming language
- Robust error handling for API calls
- Smart content parsing and recovery
- Session state management for seamless user experience
- Natural sorting for course and lesson organization
To add support for additional file formats or course structures:
- Modify
extract_text_from_folder()function - Update course info mapping in
get_course_info() - Test with your specific course format
- Adjust temperature settings in
generate_response()for different response styles - Modify system prompts for different teaching approaches
- Customize question types in exam mode
This project is intended for educational use. Please ensure compliance with your institution's academic integrity policies when using AI assistance for studying.
"No courses found"
- Ensure you have created course folders in the
Courses/directory - Check that your course folders contain lesson subfolders with
.txtfiles
"API key not found"
- Verify your
.envfile exists in the root directory - Check that your API key is correctly formatted in the
.envfile - Ensure the environment variable name matches
GOOGLE_API_KEY
"Failed to generate flashcards"
- Your course content might be too long; try shorter lessons
- Check your API quota and billing status
- Look for special characters that might break JSON parsing
App crashes or doesn't start
- Install all requirements:
pip install -r requirements.txt - Check Python version compatibility (3.8+)
- Verify all file paths and permissions
- Check the console output for detailed error messages
- Verify your course material format matches the example
- Test with the included Example-Course first
- Check the Gemini API status and your quota limits
Happy studying! 🎓✨