feat(infra): add PaddleOCR as a new OCR type (#668)

This commit is contained in:
Lin Manhui
2025-08-11 12:00:41 +08:00
committed by GitHub
parent a44e566bda
commit b19ae505f0
4 changed files with 167 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import (
"context"
"encoding/json"
"fmt"
netHTTP "net/http"
"os"
"path/filepath"
"strconv"
@@ -113,6 +114,10 @@ func InitService(c *ServiceComponents) (*KnowledgeApplicationService, error) {
inst.Client.SetAccessKey(ocrAK)
inst.Client.SetSecretKey(ocrSK)
ocrImpl = veocr.NewOCR(&veocr.Config{Client: inst})
case "paddleocr":
ppocrURL := os.Getenv("PADDLEOCR_OCR_API_URL")
client := &netHTTP.Client{}
ocrImpl = veocr.NewPPOCR(&veocr.PPOCRConfig{Client: client, URL: ppocrURL})
default:
// accept ocr not configured
}