.vscode | ||
.gitignore | ||
ankiai.py | ||
images2text.py | ||
json2deck.py | ||
prompt4cards.py | ||
README.md | ||
requirements.txt | ||
server.py |
AnkiAI
AnkiAI is a robust system that converts images containing text into structured Anki cards using Optical Character Recognition (OCR) and OpenAI's GPT-4 language model. Users can quickly generate decks of flashcards from their images for effective study.
Features
- Converts image content to textual content using OCR.
- Uses OpenAI's GPT-4 model to structure the content into Anki decks and cards.
- Outputs the structured content as an Anki package.
Dependencies
- genanki: Used for creating Anki decks and cards.
- Pillow: Image processing library.
- openai: API library for OpenAI's GPT-4 model.
- flask: Web server to host the service.
Setup and Installation
-
Clone this repository:
git clone https://git.rudefox.io/bj/anki-json2ankicards.git cd json2ankicards
-
Set up a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate
-
Install the required packages:
pip install -r requirements.txt
-
Set up the OpenAI API key:
export OPENAI_API_KEY=your_openai_api_key
-
Run the server:
python server.py
Usage
-
Start the server as mentioned above.
-
Use a tool like Postman or
curl
to send images tohttp://localhost:5000/deck-from-images
as a multi-part POST request. -
The server will respond with a downloadable Anki package. Import this into your Anki app and start studying!
Modules
- ankiai.py: The main module that orchestrates the flow.
- images2text.py: Converts image content into text using OCR.
- json2deck.py: Converts structured JSON data into an Anki package.
- prompt4cards.py: Uses OpenAI to structure the content into Anki decks and cards.
- server.py: Flask server to host the service.
Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss changes or fixes.