We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 336c12c commit 608e225Copy full SHA for 608e225
ocr_service/api/api.py
@@ -29,6 +29,12 @@ def info() -> Response:
29
30
@api.route("/process", methods=["POST"])
31
def process() -> Response:
32
+ """ Processes raw binary input stream, file, or
33
+ JSON containing the binary_data field in base64 format
34
+
35
+ Returns:
36
+ Response: json with the result of the OCR processing
37
+ """
38
stream = None
39
file_name: str = ""
40
@@ -53,6 +59,8 @@ def process() -> Response:
53
59
54
60
try:
55
61
record = json.loads(stream)
62
+ if isinstance(record, list) and len(record) > 0:
63
+ record = record[0]
56
64
if isinstance(record, dict) and "binary_data" in record.keys():
57
65
stream = base64.b64decode(record["binary_data"])
58
66
0 commit comments