Aspose.OCR Cloud SDK for Python
O maj laćho Python OCR API te ginaves thaj te lel pes o teksto e imaʒenqo
Thov OCR Funkcionaliteta ko Python Apps prekal OCR API. Kaśte śaj te ginavel pes thaj te lel pes o tèksto katar e slike, e fotògrafìe, e śerutne śerutne, e skanime dokumentură thaj e PDF-esqe lila prekal i Python OCR Library.
Aspose.OCR Cloud SDK vaś o Python si jekh avansime thaj fleksibilno optikano prinʒaripen e karakterosqo (OCR) solucia savi aźutil e softveresqe developeren te keren OCR aplikacie bi te avel len varesavo avrutno phanglipe. Vov del śajsaripen e softveresqe kerde te xramosaren thaj te len avri o tèksto katar e imaźură, e fotòra, e skrinòtură, e skanime dokumentură thaj e PDF-ură anθ-e jekh baro gin e Evropake, Cirilikane thaj Est-esqe skripturenqo, anθ-e rezultàtură anθ-e maj popularne dokumenturenqe formatură. I API kerel lokho e developerenge te thoven OCR funkcionaliteta pe sakova aparati vaj platforma, mashkar lende netbookura, mini PC-a, ja vi smartphone-a e anglune niveloske.
O Aspose.OCR Cloud SDK vash o Python si lokho thaj lokho te kerel buti. Vov del jekh baro spektro e funkcienqo save keren les jekh idealo OCR solucia vaś e developerură save keren buti e Python-eça, sar te ginaves jekh sasto patreto, te ginaves jekh skanime PDF dokumento, te lel pes o tèksto katar jekh specifiko regiono e patretosqo, te lel pes e dàte katar jekh skanime vaj fotografime kvitto, anav e PDF prinʒaripnasqe rezultàturǎ, anθar o xramosaripen e tèkstosqo katar e skanime vaj fotografime tabele, o paruvipen e prinʒaripnasqe rezultàturenqo anθ-o jekh naturalo manuśikano glaso, thaj but aver.Aspose.OCR Cloud SDK vaś o Python si kerdo opral o Aspose.OCR Cloud API, si jekh OCR motoro bazirime pe nuvero savo del suporto vaś 45 prinʒaripnasqe ćhiba, maśkar lende i anglikani, francuzikani, germanikani, spanikani, kinezikani, japanikani, arabikani, thaj but maj but. Ko utiliziribe e OCR SDK, e Python programerura śaj te integrin e OCR funkcionaliteta ande pire Python aplikacie bi te daran pal-e kompleksitetura e OCR teknologiaqe. O SDK del jekh lokho thaj intuitivo interfejso savo del śajsaripen e uźitorenqe te thoven patretura, te keren OCR, thaj te len o tèksto numaj anθ-e nesave riga kodolesqe. Te trubul te thoves OCR funkcionaliteta pe tire Python aplikacie, o Aspose.OCR Cloud SDK vash Python si definitivno te dikhes.
Te astarel pes o Aspose.OCR Cloud SDK vaś o Python
O rekomenduime drom te instalis Aspose.OCR Cloud SDK vash Python si te hasnis o pip. Mangav tumen te hasnin o śerutno komando vaś jekh śukar instalàcia.
Instalisar o Aspose.OCR Cloud SDK vaś o Python prekal o pip
pip install aspose-ocr-cloud
Tu śaj te lel o SDK direkto katar Aspose.OCR Python Cloud SDK produktoski rig
Image Recognition by Python Apps
Aspose.OCR Cloud SDK vaś o Python del śajsaripen e softveresqe kerde te keren OCR operacia te resen o prinźaripen e image-esqo and-e lenqe Python aplikacie. O API si but lokho te hasnil pes thaj o pindžaripe e imagengo šaj te kerel pes katar savi platforma savi si la internetosko akceso. Tu śaj te hasnis o OCR REST API te alosares thaj te bićhales e patretura vaś o prinʒaripen, te les e rezultàturǎ thaj te garaves len anθ-e sa e formaturǎ save si suportime e lilǎqe numaj jekh parne rigaqe kodosqe. O egzamplo so avel sikavel sar te kerel pes OCR operacia pe slike kotar o Python kodo.
import asposeocrcloud
# create an instance of the OCR client
client = asposeocrcloud.OcrApi(api_key='your_api_key', app_sid='your_app_sid')
# read the image file
with open('image.jpg', 'rb') as image_file:
image_data = image_file.read()
# call the OCR API to extract text from the image
result = client.post_ocr(image_data=image_data, language='eng', use_default_dictionaries=True)
# print the extracted text
print(result.text)
Xramosar o tèksto katar e PDF-esqe lila prekal o Python API
Portable Document Format (PDF) si jekh katar e maj popularno formatura e biznis dokumenturenqi ki lumia thaj si formato e dokumenturenqo kerdo katar o Adobe ko 1992 berś te prezentisarel dokumentură. Aspose.OCR Cloud SDK vaś o Python inklistil jekh but zurali funkcia vaś te lel pes o tèksto katar e PDF-esqe lila and-e Python-esqe aplikacie. Te areses i buti ano lokho drom trubul te thoves o PDF lil ko Aspose cloud storage thaj te keres o OCR pindžaripe ko uploadimo PDF lil. O egzàmplo so avel sikavel sar e softveresqe kerde śaj te len avri o tèksto katar jekh PDF-esqo lil labǎrindoj o Python-esqo kodo.
import asposeocrcloud
from asposeocrcloud.apis.ocr_api import OcrApi
from asposeocrcloud.configuration import Configuration
configuration = Configuration(api_key='your_api_key', app_sid='your_app_sid')
api = OcrApi(asposeocrcloud.ApiClient(configuration))
# Upload the PDF file to the Aspose cloud storage
with open('your_pdf_file.pdf', 'rb') as file:
api.upload_file(path='your_pdf_file.pdf', file=file)
# Perform the OCR recognition on the uploaded PDF file
result = api.post_recognize_ocr_from_url_or_content(file_path='your_pdf_file.pdf')
# Story the recognized text
recognized_text = result['text']
print(recognized_text)
Konvertisar o tèksto anθ-i vorba prekal o Python API
Aspose.OCR Cloud SDK vaś o Python del śajsaripen e softveresqe kerde te paruven o tèksto katar o lil bi te instalisaren varesavo softèro katar aver rig. Ko utiliziribe e API-esko, e programerura śaj te paruven e pinʒaripnasqe rezultatură anθ-o jekh naturalo manuśikano glaso savo śaj te avel baśaldo anθ-o fundo vaj te avel tele ćhudino. O angluno uźitori trubul te bićhalel o lil ko Aspose OCR Cloud server thaj te lel teksto kotar leste thaj palo odova te paruvel o teksto ki vorba kotar o Aspose OCR Cloud Text-to-Speech API. Palal i laćhi konverzia śaj te garaves o lil e lavǎqo anθ-o disko.
import os
from asposeocrcloud import OcrApi, OcrClient, SpeechApi
client_id = os.environ['CLIENT_ID']
client_secret = os.environ['CLIENT_SECRET']
ocr_api = OcrApi(OcrClient(client_id, client_secret))
speech_api = SpeechApi(OcrClient(client_id, client_secret))
# Upload the image containing the text
filename = 'image.png'
with open(filename, 'rb') as file:
response = ocr_api.post_recognize_from_content(file.read(), language='English', use_default_dictionaries=True)
# Extract the recognized text
text = ''
for result in response.parts:
for line in result.lines:
for word in line.words:
text += word.text + ' '
# Convert the text to speech
response = speech_api.post_recognize_from_text(text, language='en-US', voice_name='Ben')
# Save the speech file to disk
with open('output.wav', 'wb') as file:
file.write(response.content)