From 1bda74db83a3e71923cb97916e54ff543e6e1f10 Mon Sep 17 00:00:00 2001 From: oott123 Date: Fri, 22 Mar 2024 17:49:53 +0800 Subject: [PATCH] feat: adding azure ocr --- README.md | 10 ++++++++++ src/ocr/ocr.module.ts | 3 +++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 3c14f89..f78753d 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,16 @@ OCR_DRIVER=paddle-ocr-web OCR_ENDPOINT=http://127.0.0.1:8980/api ``` +##### Azure OCR + +创建一个 [Azure Vision](https://portal.azure.com/#create/Microsoft.CognitiveServicesComputerVision) 资源,并将资源信息配置如下: + +```bash +OCR_DRIVER=azure +OCR_ENDPOINT=https://tas.cognitiveservices.azure.com +OCR_CREDENTIALS=000000000000000000000000000000000 +``` + #### 启动不同角色 ```bash diff --git a/src/ocr/ocr.module.ts b/src/ocr/ocr.module.ts index 77e4204..b645f33 100644 --- a/src/ocr/ocr.module.ts +++ b/src/ocr/ocr.module.ts @@ -5,6 +5,7 @@ import ocrConfig from 'src/config/ocr.config' import { GoogleOCRService } from './google-ocr.service' import { OCRService } from './ocr.service' import { PaddleOCRWebService } from './paddle-ocr-web.service' +import { AzureOCRService } from './azure-ocr.service' @Module({ providers: [ @@ -21,6 +22,8 @@ import { PaddleOCRWebService } from './paddle-ocr-web.service' return moduleRef.create(GoogleOCRService) } else if (ocrCfg.driver === 'paddle-ocr-web') { return moduleRef.create(PaddleOCRWebService) + } else if (ocrCfg.driver === 'azure') { + return moduleRef.create(AzureOCRService) } try {