Go to file
B.J. Dweck 28e6c8d611 decoupled 2023-09-11 20:35:55 +03:00
.vscode overhauled the project to get away from files (a little) 2023-09-11 19:10:42 +03:00
.gitignore overhauled the project to get away from files (a little) 2023-09-11 19:10:42 +03:00
README.md overhauled the project to get away from files (a little) 2023-09-11 19:10:42 +03:00
ankiai.py decoupled 2023-09-11 20:35:55 +03:00
constants.py decoupled 2023-09-11 20:35:55 +03:00
deck_creation.py decoupled 2023-09-11 20:35:55 +03:00
image_processing.py decoupled 2023-09-11 20:35:55 +03:00
logging_config.py extracted contants and added logging 2023-09-11 20:02:17 +03:00
requirements.txt Created a server to serve apkg files in respose to image posts 2023-09-08 16:24:34 +03:00
server.py decoupled 2023-09-11 20:35:55 +03:00

README.md

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

  1. Clone this repository:

    git clone https://git.rudefox.io/bj/anki-json2ankicards.git
    cd json2ankicards
    
  2. Set up a virtual environment and activate it:

    python3 -m venv venv
    source venv/bin/activate
    
  3. Install the required packages:

    pip install -r requirements.txt
    
  4. Set up the OpenAI API key:

    export OPENAI_API_KEY=your_openai_api_key
    
  5. Run the server:

    python server.py
    

Usage

  1. Start the server as mentioned above.

  2. Use a tool like Postman or curl to send images to http://localhost:5000/deck-from-images as a multi-part POST request.

  3. The server will respond with a downloadable Anki package. Import this into your Anki app and start studying!

Modules

  1. ankiai.py: The main module that orchestrates the flow.
  2. images2text.py: Converts image content into text using OCR.
  3. json2deck.py: Converts structured JSON data into an Anki package.
  4. prompt4cards.py: Uses OpenAI to structure the content into Anki decks and cards.
  5. 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.

License

MIT License