ethanrom commited on
Commit
b97ae58
·
1 Parent(s): 34a522a

Update button_click_alt.py

Browse files
Files changed (1) hide show
  1. button_click_alt.py +9 -3
button_click_alt.py CHANGED
@@ -29,9 +29,15 @@ def infer_text(im):
29
  return text
30
 
31
 
32
- def find_order_id(uploaded_file, input_file, model):
33
- uploaded_image = Image.open(uploaded_file)
34
- text = infer_text(uploaded_image)
 
 
 
 
 
 
35
  with input_file as file:
36
  file_contents = file.read().decode()
37
  lines = file_contents.split('\n')
 
29
  return text
30
 
31
 
32
+ def find_order_id(uploaded_file, input_file, model, ocre):
33
+ if ocr_engine == 'Hive':
34
+ uploaded_image = Image.open(uploaded_file)
35
+ text = infer_text(uploaded_image)
36
+ else:
37
+ rotated = preprocess_image(uploaded_file)
38
+ text = pytesseract.image_to_string(rotated)
39
+
40
+
41
  with input_file as file:
42
  file_contents = file.read().decode()
43
  lines = file_contents.split('\n')