mirror of
https://github.com/icereed/paperless-gpt.git
synced 2025-03-13 21:28:02 -05:00
Update ocr/google_docai_provider.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
d71d340eb5
commit
81773d1127
1 changed files with 9 additions and 1 deletions
|
@ -106,7 +106,15 @@ func (p *GoogleDocAIProvider) ProcessImage(ctx context.Context, imageContent []b
|
||||||
|
|
||||||
// Add hOCR output if available
|
// Add hOCR output if available
|
||||||
if len(resp.Document.GetPages()) > 0 {
|
if len(resp.Document.GetPages()) > 0 {
|
||||||
hocr := generateHOCR(resp.Document)
|
var hocr string
|
||||||
|
func() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
logger.WithField("error", r).Error("Panic during hOCR generation")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
hocr = generateHOCR(resp.Document)
|
||||||
|
}()
|
||||||
if hocr != "" {
|
if hocr != "" {
|
||||||
result.HOCR = hocr
|
result.HOCR = hocr
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue