A Django web application for generating flash cards from text input. The application uses an LLM (Large Language Model) to automatically create question-answer pairs from any text, making it easy to create study materials for learning.
- Text to Flash Cards: Simply paste or type any text, and the application will automatically generate flash cards with questions and answers
- Interactive Learning: View and navigate through flash cards with an intuitive interface
- Click on a flash card to flip between question and answer
- Navigate between cards using previous/next buttons
- See your progress with a card counter (e.g., "3 of 10")
- AnkiDroid Integration: Generated flash cards are automatically saved in a format compatible with AnkiDroid
- The file path is displayed below the flash cards for easy access
- Import the file directly into AnkiDroid for spaced repetition learning
- Enter your text in the "Input Text" field on the left side and the endpoint in "LLM Endpoint" (llama.cpp or other)
- Click "Generate Flash Cards" (or press Enter)
- The system processes your text and generates flash cards
- View and learn from the flash cards on the right side
- The flash cards are automatically saved to a file that can be imported into AnkiDroid
-
Start the Django development server:
python manage.py runserver
-
Open your browser and navigate to
http://127.0.0.1:8000/ -
Enter your text in the input field and click "Generate Flash Cards"
-
Use the navigation buttons to browse through the generated flash cards
- After generating flash cards, the file path will be displayed below the flash cards area
- Copy the file path or locate the
flash_cards.txtfile in your project directory - Open AnkiDroid on your Android device
- Import the file using AnkiDroid's import feature
- The flash cards will be available for spaced repetition learning
The application uses environment variables for configuration:
FLASHCARD_LLM_ENDPOINT: The LLM API endpoint (default:http://127.0.0.1:8011/chat/completions)FLASHCARD_LLM_MODEL: The model name to useFLASHCARD_LLM_TIMEOUT: Request timeout in seconds (default:30)
The generated flash cards are saved in flash_cards.txt with the following format:
- First line: Questions separated by semicolons, each enclosed in quotes
- Second line: Answers separated by semicolons, each enclosed in quotes
This format is compatible with AnkiDroid's import functionality.
- Python 3.12+
- Django 5.2.8+
- requests library
-
Create a virtual environment:
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install django requests
-
Run migrations (if needed):
python manage.py migrate
-
Start the development server:
python manage.py runserver
django/
├── chat/ # Main application
│ ├── views.py # View logic and LLM integration
│ ├── prompts.py # System prompts for LLM
│ └── urls.py # URL routing
├── flashcard/ # Django project configuration
├── templates/ # HTML templates
│ └── chat/
│ └── index.html
└── flash_cards.txt # Generated flash cards file
This project is open source and available for educational and personal use.