OCR Recognition
Short description: Use the OCR API to recognize text in an image and return structured text output.
Overview
- Method:
POST - Path:
/task/gi/ocr - Content-Type:
multipart/form-data
Authentication
- Header:
Authorization: Bearer <token>
Request Example
Form Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| image | file | Yes | The source image file to be processed by OCR |
curl Example
bash
curl -X POST "https://api.gpt.ge/task/gi/ocr" \
-H "Authorization: Bearer sk-xxxx" \
-F "image=@/path/to/image.png"JavaScript (fetch) Example
javascript
const formData = new FormData();
formData.append('image', fileInput.files[0]);
fetch('https://api.gpt.ge/task/gi/ocr', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-xxxx'
},
body: formData
}).then(r => r.json()).then(console.log);Python (requests) Example
python
import requests
url = 'https://api.gpt.ge/task/gi/ocr'
headers = {
'Authorization': 'Bearer sk-xxxx'
}
files = {
'image': open('image.png', 'rb')
}
response = requests.post(url, headers=headers, files=files)
print(response.json())Response Example (200)
json
{
"text": "I am morphogen API intelligent assistant, small vv\nDo you need my help?"
}Note: This endpoint requires
multipart/form-dataupload of the image file. The response contains a singletextfield with the recognized text.