Files
fil/docs/snippets/r/ocr/ocr_paddleocr.md
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

534 B

library(kreuzberg)

# Configure PaddleOCR backend (defaults to mobile tier)
config <- list(
  force_ocr = TRUE,
  ocr = list(backend = "paddle-ocr", language = "en")
)

# Extract text from an image using PaddleOCR
json <- extract_file_sync("document.jpg", "image/jpeg", config)
result <- jsonlite::fromJSON(json, simplifyVector = FALSE)

cat(sprintf("Extracted %d characters\n", nchar(result$content)))
cat(sprintf("MIME type: %s\n", result$mime_type))
cat("Content preview:\n")
cat(substr(result$content, 1, 200))