Sergey Mikhno
commited on
Commit
·
8a7e11b
1
Parent(s):
1278481
encode
Browse files- app/app.py +3 -2
app/app.py
CHANGED
|
@@ -64,8 +64,9 @@ def doc_layout():
|
|
| 64 |
if r["type"] == "plain text":
|
| 65 |
x, y, x1, y1 = r["coords"]
|
| 66 |
x, y, x1, y1 = int(x), int(y), int(x1), int(y1)
|
| 67 |
-
|
| 68 |
-
|
|
|
|
| 69 |
result = doctr_model(single_img_doc)
|
| 70 |
print(result)
|
| 71 |
|
|
|
|
| 64 |
if r["type"] == "plain text":
|
| 65 |
x, y, x1, y1 = r["coords"]
|
| 66 |
x, y, x1, y1 = int(x), int(y), int(x1), int(y1)
|
| 67 |
+
block = pimg[y:y1,x:x1]
|
| 68 |
+
img_encoded = cv2.imencode('.png', block)[1].tobytes()
|
| 69 |
+
single_img_doc = DocumentFile.from_images(img_encoded)
|
| 70 |
result = doctr_model(single_img_doc)
|
| 71 |
print(result)
|
| 72 |
|