Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -40,13 +40,14 @@ async def create_upload_file(
|
|
40 |
ocr = get_ocr(lang=lang, use_gpu=use_gpu)
|
41 |
img2np = np.array(image)
|
42 |
result = ocr.ocr(img2np, cls=True)[0]
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
50 |
return final_result
|
51 |
|
52 |
|
|
|
40 |
ocr = get_ocr(lang=lang, use_gpu=use_gpu)
|
41 |
img2np = np.array(image)
|
42 |
result = ocr.ocr(img2np, cls=True)[0]
|
43 |
+
final_result = []
|
44 |
+
if result:
|
45 |
+
boxes = [line[0] for line in result]
|
46 |
+
txts = [line[1][0] for line in result]
|
47 |
+
scores = [line[1][1] for line in result]
|
48 |
+
|
49 |
+
# 识别结果
|
50 |
+
final_result = [dict(boxes=box, txt=txt, score=score) for box, txt, score in zip(boxes, txts, scores)]
|
51 |
return final_result
|
52 |
|
53 |
|