cancel
Showing results for 
Search instead for 
Did you mean: 

Current AI Core OCR Solution ?

lprell
Explorer
0 Kudos
124

Im currently looking to implement a centralized web api hosted through the aicore btp service which lets me perform OCR on whatever file i want. 

The most promising implementation which i could understand (sometimes im running into blog post which i simply dont understand) was to host a simple flask api through aicore which uses the open source pytesseract package / model. Although that would work it doesnt seem like the best practice way of accomplishing the goal since im not actually using aicore itself for anything really. I just use it for hosting purpouse.

So what would be the best way to implement this OCR web api ?

View Entire Topic
yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

@lprell 

if you have SAP AI Core License, you can choose better model and Use the deployment URL and authorization token to make API calls to the OCR model.

below is the sample curl command.. 

curl --location '<deployment_url>/invoke' \
--header 'AI-Resource-Group: <resource_group>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <auth_token>' \
--data '{
  "messages": [
    {
      "role": "user",
      "content": "<base64_encoded_image>"
    }
  ]
}'

 

if the above curl command works fine, then you can implement via

  • Develop a web API that interfaces with your deployed OCR model. You can use frameworks like Flask (Python) or Express (Node.js) to create the API.
  • The API should accept image input, send it to the OCR model for processing, and return the recognized text.
lprell
Explorer
0 Kudos
Hi, i really appreciate your quick answer. I do have a SAP AI Core License and i have also worked with the web api to interpret images before. But using base64 encoded images would mean i need to convert my files to images before running OCR and also im not sure which model to deploy exactly. I was hoping there is one that is specified on OCR or would u think that any model is fine since most of them have some type of image recognition ?
yogananda
Product and Topic Expert
Product and Topic Expert

@lprell  yes that's right, before running OCR.. you have to convert the image to Base64encoding

Available models to accept images.. there are 12 today.. (click on image to view better)

yogananda_0-1742574862702.png