Text Recognition

Introduction

Text Recognition api allow you to extract text from image , video or any visual documents. Our Api are trained to detect more than 100 different languages and many scripts.

Text Recognition

Supported languages
"afr", "amh", "ara", "asm", "aze", "bel", "ben", "bod", "bos", "bre", "bul", "cat", "ceb", "ces", "chi_sim", "chi_tra", "chr", "cos", "cym", "dan", "deu", "div", "dzo", "ell", "eng", "enm", "epo", "equ", "est", "eus", "fao", "fas", "fil", "fin", "fra", "frk", "frm", "fry", "gla", "gle", "glg", "grc", "guj", "hat", "heb", "hin", "hrv", "hun", "hye", "iku", "ind", "isl", "ita", "ita_old", "jav", "jpn", "jpn_vert", "kan", "kat", "kat_old", "kaz", "khm", "kir", "kmr", "kor", "lao", "lat", "lav", "lit", "ltz", "mal", "mar", "mkd", "mlt", "mni", "mon", "mri", "msa", "mya", "nep", "nld", "nor", "oci", "ori", "osd", "pan", "pol", "por", "pus", "que", "ron", "rus", "san", "sat", "sin", "slk", "slv", "snd", "spa", "spa_old", "sqi", "srp", "srp_latn", "sun", "swa", "swe", "syr", "tam", "tat", "tel", "tgk", "tha", "tir", "ton", "tur", "uig", "ukr", "urd", "uzb", "uzb_cyrl", "vie", "yid", "yor"These are 3 digits language code. You can look up for Language Code

Endpoint

Post
   https://api.oyyi.xyz/v1/ml/text-recognition

Content-Type: multipart/form-data

Parameters

  • file

    AN image file need to be uploaded that contains text to extract the character from it.
    • Type: File
      Size: Max File Size Allowed 100MB
  • lang

    • Type: string
    • Allowed: lang code from above suppored languages
    • Default: eng
  • type

    • Type: string
    • Allowed: text,data,osd,box
    • Default: text

Example

Image used

Python
import requestsurl = $BASE_URL/ml/text-recognitiontoken = 'your_bearer_token_here'headers = {'Authorization': f'Bearer {token}'}files = {'file': open('example_file.jpg', 'rb')}response = requests.post(url,params=params, headers=headers, files=files)print(response.text)
Javascript
const axios = require('axios');const url = $BASE_URL/ml/text-recognition;const token = 'your_bearer_token_here';const formData = new FormData();formData.append('file', YOUR FILE);formData.append('lang', 'eng');const config = {  headers: {    'Authorization': `Bearer ${token}`,    'Content-Type': 'multipart/form-data'  }};axios.post(url, formData, config)  .then(response => console.log(response.data))  .catch(error => console.error(error));
Dart
import 'dart:io';import 'package:http/http.dart' as http;void main() async {   final url = Uri.parse('$BASE_URL/ml/text-recognition');  final headers = {'Content-Type': 'multipart/form-data'};  final request = http.MultipartRequest('POST', url);  request.headers.addAll(headers);  request.fields['lang'] = 'eng';  request.files.add(await http.MultipartFile.fromPath('file', '/path/to/file'));  final response = await request.send();}
Laravel
use Illuminate\Http\Client\Response;use Illuminate\Support\Facades\Http;$url = '$BASE_URL/ml/text-recognition';$token = 'your_bearer_token_here';$response = Http::withHeaders([    'Authorization' => 'Bearer ' . $token,])->attach('file', $file_path)->post($url);if ($response->successful()) {    $data = $response->json();} else {m    $message = $response->json()['message'];}
Curl
curl -X POST \  -H 'Authorization: Bearer your_bearer_token_here' \  -F 'file=@/path/to/your/file' \  $BASE_URL/ml/text-recognition

Response

text
{  "data": [    "Oyyi is free to Use"  ]}
data
{  "data": [    {      "block_num": 1,      "conf": 76.084854,      "height": 81,      "left": 86,      "level": 5,      "line_num": 1,      "page_num": 1,      "par_num": 1,      "text": "Oyyi",      "top": 117,      "width": 191,      "word_num": 1    },    {      "block_num": 1,      "conf": 95.796791,      "height": 63,      "left": 306,      "level": 5,      "line_num": 1,      "page_num": 1,      "par_num": 1,      "text": "is",      "top": 117,      "width": 63,      "word_num": 2    },    {      "block_num": 1,      "conf": 95.796791,      "height": 63,      "left": 400,      "level": 5,      "line_num": 1,      "page_num": 1,      "par_num": 1,      "text": "free",      "top": 117,      "width": 165,      "word_num": 3    },    {      "block_num": 1,      "conf": 96.92823,      "height": 55,      "left": 594,      "level": 5,      "line_num": 1,      "page_num": 1,      "par_num": 1,      "text": "to",      "top": 125,      "width": 79,      "word_num": 4    },    {      "block_num": 1,      "conf": 96.194183,      "height": 62,      "left": 702,      "level": 5,      "line_num": 1,      "page_num": 1,      "par_num": 1,      "text": "Use",      "top": 118,      "width": 154,      "word_num": 5    }  ],}
osd
{  "data": {    "orientation": 270,    "orientation_conf": 14,    "page_num": 0,    "rotate": 90,    "script": "Latin",    "script_conf": 2  },}
box
{  "data": [    "O 86 123 148 186 0",    "y 134 105 180 186 0",    "y 152 105 253 166 0",    "i 255 124 277 186 0",    "i 306 124 328 186 0",    "s 334 123 369 167 0",    "f 400 124 464 186 0",    "r 449 123 487 186 0",    "e 469 123 513 167 0",    "e 520 123 565 167 0",    "t 594 123 622 178 0",    "o 628 123 673 167 0",    "U 702 123 764 185 0",    "s 769 123 804 167 0",    "e 812 123 856 167 0"  ],}