Spaces:
Running
on
T4
Running
on
T4
Update onnx_text_recognition.py
Browse files- onnx_text_recognition.py +2 -2
onnx_text_recognition.py
CHANGED
@@ -24,7 +24,7 @@ class TextRecognition:
|
|
24 |
def init_processor(self):
|
25 |
"""Function for initializing the processor."""
|
26 |
try:
|
27 |
-
processor = TrOCRProcessor.from_pretrained(self.processor_path)
|
28 |
return processor
|
29 |
except Exception as e:
|
30 |
print('Failed to initialize processor: %s' % e)
|
@@ -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)#, 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)
|
|
|
24 |
def init_processor(self):
|
25 |
"""Function for initializing the processor."""
|
26 |
try:
|
27 |
+
processor = TrOCRProcessor.from_pretrained(self.processor_path, use_auth_token=True)
|
28 |
return processor
|
29 |
except Exception as e:
|
30 |
print('Failed to initialize processor: %s' % e)
|
|
|
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, use_auth_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)
|