Spaces:
Build error
Build error
Commit
·
9472f8c
1
Parent(s):
a73ee78
Update main.py
Browse files
main.py
CHANGED
@@ -7,8 +7,8 @@ import torch
|
|
7 |
|
8 |
device = 'gpu' if torch.cuda.is_available() else 'cpu'
|
9 |
|
10 |
-
ocr = MMOCRInferencer(
|
11 |
-
|
12 |
device=device)
|
13 |
|
14 |
def get_rec(points):
|
@@ -27,7 +27,7 @@ def predict(image_input, score_threshold):
|
|
27 |
print('image shape', image_input.shape, file=sys.stderr)
|
28 |
|
29 |
try:
|
30 |
-
|
31 |
except:
|
32 |
output = dict(det_polygons=[], det_scores=[])
|
33 |
|
|
|
7 |
|
8 |
device = 'gpu' if torch.cuda.is_available() else 'cpu'
|
9 |
|
10 |
+
ocr = MMOCRInferencer(det='model/det/config.py',
|
11 |
+
det_weights='model/det/model.pth',
|
12 |
device=device)
|
13 |
|
14 |
def get_rec(points):
|
|
|
27 |
print('image shape', image_input.shape, file=sys.stderr)
|
28 |
|
29 |
try:
|
30 |
+
return ocr.readtext(image_input)
|
31 |
except:
|
32 |
output = dict(det_polygons=[], det_scores=[])
|
33 |
|