diff --git a/.gitignore b/.gitignore index 5ceb386..3a28a0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ venv +api_key diff --git a/data.py b/data.py new file mode 100755 index 0000000..7002f5c --- /dev/null +++ b/data.py @@ -0,0 +1,28 @@ +from PIL import Image +from openai import OpenAI +import pytesseract as OCR +import os + +OCR.pytesseract.tesseract_cmd = r"/usr/local/bin/tesseract" + +client = OpenAI( + api_key = os.environ.get("OPENAI_API_KEY"), +) + +def app(): + # data shit --> where does it come from??? + data = OCR.image_to_string("input.png") + print(data) + + complete = client.chat.completions.create( + model="gpt-3.5-turbo", + messages = [ + { + "role": "user", + "content": "parse the following data in JSON format: ${data}", + } + ]) + + print(complete.choices[0].message.content) + +app() diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..356c1c1 --- /dev/null +++ b/start.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +export OPENAI_API_KEY="$(cat api_key)" + +python3 main.py