이 문서는 영어 원문을 자동 번역한 것으로, 내용이 원문과 다를 수 있습니다.영어 원문 보기
예시
요청

# pip install requests
import requests
api_key = "UPSTAGE_API_KEY"
filename = "YOUR_FILE_NAME"
url = "https://api.upstage.ai/v1/document-digitization"
headers = {"Authorization": f"Bearer {api_key}"}
files = {"document": open(filename, "rb")}
data = {"model": "ocr"}
response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())응답
{
"apiVersion": "1.1",
"confidence": 0.9924988460974842,
"metadata": {
"pages": [
{
"height": 256,
"page": 1,
"width": 786
}
]
},
"mimeType": "multipart/form-data",
"modelVersion": "ocr-260930",
"numBilledPages": 1,
"pages": [
{
"confidence": 0.9924988460974842,
"height": 256,
"id": 0,
"text": "Print the words \nhello, world",
"width": 786,
"words": [
{
"boundingBox": {
"vertices": [
{
"x": 65,
"y": 52
},
{
"x": 221,
"y": 55
},
{
"x": 221,
"y": 104
},
{
"x": 64,
"y": 101
}
]
},
"confidence": 0.9950619419121907,
"id": 0,
"text": "Print"
},
{
"boundingBox": {
"vertices": [
{
"x": 243,
"y": 49
},
{
"x": 341,
"y": 52
},
{
"x": 340,
"y": 105
},
{
"x": 241,
"y": 102
}
]
},
"confidence": 0.9989913157886589,
"id": 1,
"text": "the"
},
{
"boundingBox": {
"vertices": [
{
"x": 368,
"y": 52
},
{
"x": 553,
"y": 51
},
{
"x": 553,
"y": 105
},
{
"x": 368,
"y": 105
}
]
},
"confidence": 0.9890200556796326,
"id": 2,
"text": "words"
},
{
"boundingBox": {
"vertices": [
{
"x": 214,
"y": 131
},
{
"x": 470,
"y": 149
},
{
"x": 467,
"y": 206
},
{
"x": 210,
"y": 188
}
]
},
"confidence": 0.9933670202605895,
"id": 3,
"text": "hello,"
},
{
"boundingBox": {
"vertices": [
{
"x": 527,
"y": 145
},
{
"x": 748,
"y": 143
},
{
"x": 749,
"y": 192
},
{
"x": 527,
"y": 194
}
]
},
"confidence": 0.986053896846349,
"id": 4,
"text": "world"
}
]
}
],
"stored": true,
"text": "Print the words \nhello, world"
}