2

I've implemented a custom model at Azures's form recognizer. In performance test, using PDF and JPEG files to do the text extraction, the hole process is being executed at Azure and are getting ~4.5s to response the requests.

My question is, There's a way to improve these response time?

There's my test code:

const processFile = (path) => axios({
    url: RECOGNIZER_URL,
    method: "POST",
    headers: {
        "Ocp-Apim-Subscription-Key": RECOGNIZER_KEY,
        'Content-Type': `application/json`
    },
    data: {
        "urlSource": path 
    }
})

const getResult = (location) => axios({
    url: location,
    method: "GET",
    headers: {
        "Ocp-Apim-Subscription-Key": RECOGNIZER_KEY
    },
})

const testOcr = async (imageURL) => {
    console.time('#testOcrTime');

    let res = await processFile(imageURL)
    .then(async response => {
        let result = await getResult(response.headers["operation-location"])
        while(((result.data) || {}).status == "running"){
            result = await getResult(response.headers["operation-location"])
        }
        return result
    })
    .then(response => {console.log(response)
    return response.data.analyzeResult.documents[0].fields})
    .catch(err => console.error(err))

    console.timeEnd('#testOcrTime');
    console.log(res)
    return
}

testOcr()

Azure's Documentation

Denys Wylliam
  • 129
  • 2
  • 12

0 Answers0