Spaces:
Sleeping
Sleeping
Update button_click_alt.py
Browse files- 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 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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')
|