Skip to content

Commit

Permalink
Update image_loading.py
Browse files Browse the repository at this point in the history
  • Loading branch information
salmon-raye authored Jan 21, 2024
1 parent b94249e commit c6794b3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions image_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from openai import OpenAI
from paddleocr import PaddleOCR


def load_image():
uploaded_file = st.file_uploader(label='Upload your test results image below:')
if uploaded_file is not None:
Expand All @@ -19,10 +18,13 @@ def load_image():


def extract_text(image,ocr_model):
ocr_start_time = time.time()
result = ocr_model.ocr(image)
result = result[0] #idk why this needs a result[0] instead of result for Github
#result = result[0] #idk why this needs a result[0] instead of result for Github
extracted_text = ''
for idx in range(len(result)):
txt = result[idx][1][0]
extracted_text += txt + " "
return extracted_text
ocr_end_time = time.time()
ocr_time = int(ocr_end_time - ocr_start_time)
return extracted_text, ocr_time

0 comments on commit c6794b3

Please sign in to comment.