Skip to content

Commit

Permalink
fix: Fixed API
Browse files Browse the repository at this point in the history
  • Loading branch information
fg-mindee committed Sep 20, 2021
1 parent 9e267e8 commit 6a572a0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/app/routes/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
async def text_detection(file: UploadFile = File(...)):
"""Runs DocTR text detection model to analyze the input"""
img = decode_img_as_tensor(file.file.read())
boxes, _ = det_predictor([img], training=False)[0]
boxes, _ = det_predictor([img])[0]
return [DetectionOut(box=box.tolist()) for box in boxes[:, :-1]]
2 changes: 1 addition & 1 deletion api/app/routes/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
async def perform_ocr(file: UploadFile = File(...)):
"""Runs DocTR OCR model to analyze the input"""
img = decode_img_as_tensor(file.file.read())
out = predictor([img], training=False)
out = predictor([img])

return [OCROut(box=(*word.geometry[0], *word.geometry[1]), value=word.value)
for word in out.pages[0].blocks[0].lines[0].words]
2 changes: 1 addition & 1 deletion api/app/routes/recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
async def text_recognition(file: UploadFile = File(...)):
"""Runs DocTR text recognition model to analyze the input"""
img = decode_img_as_tensor(file.file.read())
out = reco_predictor([img], training=False)
out = reco_predictor([img])
return RecognitionOut(value=out[0][0])

0 comments on commit 6a572a0

Please sign in to comment.