This guide will take you through the steps to create custom Anki decks using Python, GPT4, and LangChain.
Before getting started, please ensure the following:
-
Anki is installed on your system. If not, use the following command to install Anki:
brew install anki
-
You have cloned this GitHub repository onto your local machine.
-
You have your OpenAI API key ready for usage.
-
Navigate to the root directory of the cloned repository.
-
Setup the necessary dependencies by running the Make file:
make setup
-
Open the
.env
file and add the following information:- Name of your Anki deck.
- Your OpenAI API key.
Follow these steps to generate flashcards and convert them into an Anki deck:
-
Paste the text from which you want to create Anki cards into the
input.txt
file. -
Switch to the
src
directory and run thegenerate_flashcards.py
script to generate flashcards in CSV format:python generate_flashcards.py
This will automatically generate a CSV file. If you wish to create additional cards, simply add new text into the
input.txt
file and rerun thegenerate_flashcards.py
script. It will append the new cards to the existing CSV. -
Convert the CSV file to an Anki deck using the
generate_deck.py
script:python generate_deck.py
-
The Anki deck will be created in the
csv
directory. -
Open the Anki app and import the deck using the app's import function.