Eden AI Docs
Search…
OCR Raw
Optical Character Recognition (OCR) is the electronic or mechanical conversion of images of typed, handwritten or printed text into machine-encoded text, whether from a scanned or photo document.
post
https://api.edenai.run/v1/pretrained
/ocr/ocr
OCR Raw
Supported languages:
Name
Type
Value
Arabic
string
ar-XA
Chinese - Simplified
string
zh-CN
Chinese - Traditional
string
zh-TW
Czech
string
cz-CZ
Danish
string
da-DK
Dutch
string
nl-NL
English
string
en-US
Finnish
string
fn-FN
French
string
fr-FR
German
string
de-DE
Greek
string
gr-GR
Hungarian
string
hu-HU
Italian
string
it-IT
Japanese
string
ja-JP
Korean
string
ko-KR
Polish
string
pl-PO
Portuguese
string
pt-PT
Russian
string
ru-RU
Swedish
string
sw-SW
Spanish
string
es-ES
Here is the list of available providers, the associated parameter values and engines version:
Name
Value
Version
Google Cloud
google
v1
Microsoft Azure
microsoft
v3.2
Amazon Web Services
amazon
boto3 (v1.15.18)
Clarifai
clarifai
8.0.0
Base64
base64
latest
Tesseract
tesseract
latest
If you want to use Eden AI SDK for OCR Raw, you can just copy paste this code:
Python
PHP
JavaScript
C#
1
# pip install edenai
2
3
from edenai import OCR
4
5
# Get your API key here: https://app.edenai.run/admin/account
6
ocr_apis = OCR("Your_API_key")
7
8
result = ocr_apis.basic(
9
# Available providers, languages and formats here: https://api.edenai.run/v1/redoc/#operation/OCR
10
providers=["google","amazon"],
11
language="en-US",
12
file="your_image.png")
13
14
print(result)
Copied!
1
<?php
2
require_once(__DIR__ . '/vendor/autoload.php');
3
// Configure API key authorization: Bearer
4
$config = edenai\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
5
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
6
// $config = edenai\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
7
8
$apiInstance = new edenai\Api\OCRApi(
9
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
10
// This is optional, `GuzzleHttp\Client` will be used as default.
11
new GuzzleHttp\Client(),
12
$config
13
);
14
$files = "files_example"; // string |
15
$providers = "providers_example"; // string |
16
$language = "language_example"; // string |
17
18
try {
19
$result = $apiInstance->ocr($files, $providers, $language);
20
print_r($result);
21
} catch (Exception $e) {
22
echo 'Exception when calling OCRApi->ocr: ', $e->getMessage(), PHP_EOL;
23
}
24
?>
Copied!
1
import {EdenAiApiDocumentation} from 'eden_ai_api_documentation';
2
let defaultClient = EdenAiApiDocumentation.ApiClient.instance;
3
4
// Configure API key authorization: Bearer
5
let Bearer = defaultClient.authentications['Bearer'];
6
Bearer.apiKey = 'YOUR API KEY';
7
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
8
//Bearer.apiKeyPrefix = 'Token';
9
10
let apiInstance = new EdenAiApiDocumentation.OCRApi();
11
let files = "files_example"; // Blob |
12
let providers = "providers_example"; // String |
13
let language = "language_example"; // String |
14
15
apiInstance.ocr(files, providers, language, (error, data, response) => {
16
if (error) {
17
console.error(error);
18
} else {
19
console.log('API called successfully. Returned data: ' + data);
20
}
21
});
Copied!
1
using System;
2
using System.Diagnostics;
3
using EdenAI.Api;
4
using EdenAI.Client;
5
using EdenAI.Model;
6
7
namespace Example
8
{
9
public class OcrExample
10
{
11
public void main()
12
{
13
// Configure API key authorization: Bearer
14
Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
15
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
16
// Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");
17
18
var apiInstance = new OCRApi();
19
var files = new System.IO.Stream(); // System.IO.Stream | File to analyse (ex: pdf, jpg, jpeg, png, tiff)
20
var providers = providers_example; // string | Providers to compare (ex: [ 'amazon', 'microsoft', 'ibm', 'google'])
21
var language = language_example; // string | Language code expected (ex: fr-FR)
22
23
try
24
{
25
InlineResponse2001 result = apiInstance.Ocr(files, providers, language);
26
Debug.WriteLine(result);
27
}
28
catch (Exception e)
29
{
30
Debug.Print("Exception when calling OCRApi.Ocr: " + e.Message );
31
}
32
}
33
}
34
}
Copied!
Last modified 18h ago
Copy link