如何在python文件中运行midee doctr?

问题描述 投票:0回答:1

当我尝试使用 python 文件运行以下代码时:

import os
os.environ['USEA-TF'] ='1'

from doctr.io import DocumentFile
from doctr.models import ocr_predictor

model = ocr_predictor(pretrained=True)
document = DocumentFile.from_images('IM.jpg')

result = model(document)
result.show(document)
json_response = result.export()
print(json_response)

出现此错误:-

ImportError: cannot import name 'OrderedDict' from 'typing' (c:\users\shubham nagar\appdata\local\programs\python\python37\lib\typing.py)

我如何才能在.py文件中运行

python python-typing importerror doctr
1个回答
1
投票

尝试下面的代码示例

from doctr.io import DocumentFile
from doctr.models import ocr_predictor
import json

model = ocr_predictor(det_arch = 'db_resnet50',    
                      reco_arch = 'crnn_vgg16_bn', 
                      pretrained = True)
© www.soinside.com 2019 - 2024. All rights reserved.