diff --git a/README.md b/README.md index fdeea44..b21dcd1 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,15 @@ AnkiAI is a tool that leverages OCR (Optical Character Recognition) and GPT-3's ### Requirements +#### System Dependencies + +You need Tesseract for the OCR functionality: + +```bash +sudo apt-get install tesseract-ocr +``` +#### Python Dependencies + To run AnkiAI, you'll need to have the following dependencies installed: ``` @@ -29,7 +38,7 @@ openai flask ``` -You can install these via `pip` using the `requirements.txt` file: +You can install the Python dependencies via `pip` using the `requirements.txt` file: ```bash pip install -r requirements.txt @@ -38,7 +47,11 @@ pip install -r requirements.txt ### How to Run 1. **Environment Variables**: Make sure to set the `OPENAI_API_KEY` environment variable to your OpenAI API key. - + + ```bash + export OPENAI_API_KEY=sk-myapikey + ``` + 2. **Run the Flask server**: ```bash @@ -55,6 +68,29 @@ pip install -r requirements.txt python ankiai.py ``` +### Example curl commands to interact with the service: + +You can make POST requests to the server using curl. Here are some examples from the command line history: + +```bash +curl -X POST -o deck.apkg \ +-F "image=@/home/ubuntu/Pictures/image1.png" \ +-F "image=@/home/ubuntu/Pictures/image2.png" \ +-F "image=@/home/ubuntu/Pictures/image3.png" \ +http://localhost:5000/deck-from-images +``` + +Batch processing of images: + +```bash +for file in /home/ubuntu/Pictures/*; do + if [[ -f "$file" ]]; then + basefile=$(basename "$file"); + curl -X POST -o "deck-${basefile}.apkg" -F "image=@${file}" http://localhost:5000/deck-from-images; + fi; +done +``` + ### How to Debug (VSCode Users) - Open the project in VSCode.