This commit is contained in:
18
docs/snippets/r/ocr/ocr_paddleocr.md
Normal file
18
docs/snippets/r/ocr/ocr_paddleocr.md
Normal file
@@ -0,0 +1,18 @@
|
||||
```r title="R"
|
||||
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))
|
||||
```
|
||||
Reference in New Issue
Block a user