Skip to content

Commit

Permalink
feat: adding azure ocr
Browse files Browse the repository at this point in the history
  • Loading branch information
oott123 committed Mar 22, 2024
1 parent 885aa97 commit 1bda74d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/ocr/ocr.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -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 {
Expand Down

0 comments on commit 1bda74d

Please sign in to comment.