From d51bb4a5624c9f7195c2d220a5e298128839a39f Mon Sep 17 00:00:00 2001 From: Agnosto Dvonik Date: Sat, 24 Feb 2024 11:46:12 -0500 Subject: [PATCH] add data prototype for testing; start.sh for launching things --- .gitignore | 1 + data.py | 20 ++++++++++++++++++++ main.py | 2 ++ start.sh | 5 +++++ 4 files changed, 28 insertions(+) create mode 100755 data.py create mode 100644 start.sh 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..206e8bc --- /dev/null +++ b/data.py @@ -0,0 +1,20 @@ +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) + +""" +UNFINISHED +""" diff --git a/main.py b/main.py index f55d06d..8dc2e3a 100755 --- a/main.py +++ b/main.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 import sqlite3 from flask import Flask, request, jsonify +from flask import render_template +import data app = Flask(__name__) 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