--- title: 'AI Flashcard Generator ' sdk: streamlit emoji: 📚 colorFrom: blue colorTo: purple pinned: false sdk_version: 1.58.0 app_file: app.py --- # AI-Powered Flashcard Generator A Streamlit web app that turns lecture notes into exam-revision flashcards. ## Features - Upload lecture notes as PDF, TXT, or image files. - Extract and clean raw text with PyMuPDF for PDFs. - Split notes into 300-500 token chunks. - Summarise chunks with a Hugging Face T5/BART model. - Use LangChain prompt templates for a three-step generation pipeline: - Extract key concepts as JSON. - Generate Q&A flashcards as JSON. - Optionally rewrite easy cards into harder Bloom's Taxonomy questions. - Export flashcards as Anki-compatible CSV. - Optionally export `.apkg` when `genanki` is installed. ## Setup ```bash python -m venv .venv source .venv/bin/activate pip install -r requirements.txt ``` ## Run ```bash streamlit run app.py ``` The first summarisation run can take a while because Transformers may download the selected model. ## Test ```bash pytest ``` ## Notes - Image extraction uses `pytesseract` when it is installed and Tesseract OCR is available on your system. - If Hugging Face model loading fails, the app falls back to a deterministic extractive summary so the project remains usable offline. - CSV exports can be imported into Anki with the first field as `Front` and the second field as `Back`.