Spaces:
Sleeping
Sleeping
rogerxavier
commited on
Commit
•
abf0b62
1
Parent(s):
65a3cad
Update api.py
Browse files
api.py
CHANGED
@@ -9,6 +9,7 @@ import numpy as np
|
|
9 |
import urllib.request
|
10 |
import io
|
11 |
import os
|
|
|
12 |
|
13 |
app = FastAPI()
|
14 |
|
@@ -25,13 +26,6 @@ async def getCoordinates(image: UploadFile = File(...)):
|
|
25 |
image = Image.open(io.BytesIO(img)).convert("L").convert("RGB")
|
26 |
path_to_image = "save.jpg"
|
27 |
image.save(path_to_image)
|
28 |
-
result =
|
29 |
-
path_to_image,
|
30 |
-
input_character_detection_threshold,
|
31 |
-
input_panel_detection_threshold,
|
32 |
-
input_text_detection_threshold,
|
33 |
-
input_character_character_matching_threshold,
|
34 |
-
input_text_character_matching_threshold,
|
35 |
-
)
|
36 |
os.remove(path_to_image)
|
37 |
return result
|
|
|
9 |
import urllib.request
|
10 |
import io
|
11 |
import os
|
12 |
+
from ofa_ocr import ofa_ocr_gr ##导入ofa_ocr中的大函数,方便使用其获取坐标的子函数
|
13 |
|
14 |
app = FastAPI()
|
15 |
|
|
|
26 |
image = Image.open(io.BytesIO(img)).convert("L").convert("RGB")
|
27 |
path_to_image = "save.jpg"
|
28 |
image.save(path_to_image)
|
29 |
+
result = ofa_ocr_gr.ocr_api(path_to_image)[2]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
os.remove(path_to_image)
|
31 |
return result
|