Updated README.md with curl command and tesseract dependency

master
B.J. Dweck 2023-09-21 15:02:06 +03:00
parent 3f3cc276f2
commit 6c1ece44ab
1 changed files with 38 additions and 2 deletions

View File

@ -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 <directory_path_containing_images>
```
### 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.