Skip to content

Repository files navigation

Flashcard Generator

Open-source Python app for generating flashcards from learning materials using open LLMs, developed as part of GSoC 2026, with AnkiDroid as mentoring organization.

Features

  • Takes learning materials as input: supports .txt, .PDF, and .md/.markdown.
  • Uses a local Ollama model for generation: users may pick their model of choice.
  • Generates basic-style flashcards: Q&A format, atomic, concise, grounded.
  • Writes the generated cards to disk: exports them as JSON or CSV.
  • Shares the cards with AnkiDroid via the companion Android app (coming soon).

Setup

  1. Clone the project.
  2. Install uv.
  3. Install ollama and run ollama pull gemma4.

Optional but recommended, for shorter commands, install just:

uv tool install rust-just

If you don't install it, replace just with uv run just in the commands below.

Usage

  1. Run the app with just run and open it in the browser.
  2. Upload learning materials, pick a model, and start generation.
  3. Download the cards or share them with AnkiDroid via the companion app (coming soon).

Demo

flashcard-generator-demo.mov

Constraints

For now, the app has the following constraints:

  • Supports only UTF-8-encoded text and Markdown files.
  • Supports only PDFs with highlightable text, not scanned PDFs.
  • PDFs with images require a vision-capable model, such as gemma4.
  • Requires the companion Android app for pushing cards to AnkiDroid.
  • Generated flashcards in Q&A format only, i.e. basic notes.

Development

The justfile contains useful development commands. Here's a selection:

just                # Show all commands
just format         # Format the code
just lint           # Lint the code
just typecheck      # Typecheck the code
just test           # Run all tests
just fix            # Run all mutable QA: auto-fix issues
just check          # Run all non-mutable QA: signal issues

Pipeline

The app is structured as a pipeline with the following components:

flashcard-generator-pipeline

Structure

The project is broken down into the following modules, which roughly correspond to each step in our pipeline.

.
├── LICENSE
├── README.md
├── justfile
├── pyproject.toml
├── src
│   └── flashcard_generator
│       ├── app.py          # UI and app flow
│       ├── card.py         # Pydantic card models
│       ├── clean.py        # Document cleaning
│       ├── export.py       # Card exporting
│       ├── extract.py      # Document extracting
│       ├── generate.py     # Card generation
│       ├── pipeline.py     # Pipeline orchestration
│       ├── prompt.py       # Prompt definitions
│       └── share.py        # Card sharing
├── tests
│   └── ...
└── uv.lock

License

This software is distributed with an AGPL licence. Refer to LICENSE for more details.

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages