Update onnx_text_recognition.py
Browse files- onnx_text_recognition.py +2 -2
onnx_text_recognition.py
CHANGED
@@ -10,7 +10,7 @@ class TextRecognition:
|
|
10 |
def __init__(self,
|
11 |
processor_path,
|
12 |
model_path,
|
13 |
-
device = '
|
14 |
half_precision = False,
|
15 |
line_threshold = 10):
|
16 |
self.device = device
|
@@ -35,7 +35,7 @@ class TextRecognition:
|
|
35 |
sess_options.intra_op_num_threads = 3
|
36 |
sess_options.inter_op_num_threads = 3
|
37 |
try:
|
38 |
-
recognition_model = ORTModelForVision2Seq.from_pretrained(self.model_path, token=True
|
39 |
return recognition_model
|
40 |
except Exception as e:
|
41 |
print('Failed to load the text recognition model: %s' % e)
|
|
|
10 |
def __init__(self,
|
11 |
processor_path,
|
12 |
model_path,
|
13 |
+
device = 'cuda:0',
|
14 |
half_precision = False,
|
15 |
line_threshold = 10):
|
16 |
self.device = device
|
|
|
35 |
sess_options.intra_op_num_threads = 3
|
36 |
sess_options.inter_op_num_threads = 3
|
37 |
try:
|
38 |
+
recognition_model = ORTModelForVision2Seq.from_pretrained(self.model_path, token=True, session_options=sess_options, provider="CUDAExecutionProvider")
|
39 |
return recognition_model
|
40 |
except Exception as e:
|
41 |
print('Failed to load the text recognition model: %s' % e)
|