Valid AI-102 Dumps shared by EduDump.com for Helping Passing AI-102 Exam! EduDump.com now offer the newest AI-102 exam dumps, the EduDump.com AI-102 exam questions have been updated and answers have been corrected get the newest EduDump.com AI-102 dumps with Test Engine here:
You are developing a method that uses the Computer Vision client library. The method will perform optical character recognition (OCR) in images. The method has the following code. During testing, you discover that the call to the GetReadResultAsync method occurs before the read operation is complete. You need to prevent the GetReadResultAsync method from proceeding until the read operation is complete. Which two actions should you perform? Each correct answer presents part of the solution. (Choose two.) NOTE: Each correct selection is worth one point.
Correct Answer: B,D
Comprehensive Detailed ExplanationThe method shown uses the Read API of the Azure Computer Vision client library. The ReadAsync call submits the OCR job and returns an Operation-Location header, which contains the operationId. Then GetReadResultAsync(Guid.Parse(operationId)) is called to fetch the result. * The Read API is asynchronous. * Submitting the read request does not mean the OCR has finished. * If you immediately call GetReadResultAsync, the operation may still be in progress, resulting in incomplete or empty results. * Check the results.Status property * The response from GetReadResultAsync includes a status property. * Possible values: notStarted, running, succeeded, failed. * You must wait until the status is succeeded before processing results. * This ensures you don't attempt to read lines before OCR has completed. * This corresponds to B. * Wrap in a loop with delay * Since OCR takes time, you need to poll the service until the status becomes succeeded or failed. * A typical pattern is: * ReadOperationResult results; * do * { * results = await client.GetReadResultAsync(Guid.Parse(operationId)); * await Task.Delay(1000); // wait 1 second before retrying * } * while (results.Status == OperationStatusCodes.Running || results.Status == OperationStatusCodes. NotStarted); * This corresponds to D. The IssueRequired Fixes * A. Remove the Guid.Parse(operationId) parameter * Incorrect. The operationId is required to fetch the OCR results. * B. Add code to verify the results.Status value * Correct. You must check whether the operation has completed. * C. Add code to verify the status of the txtHeaders.Status value * Incorrect. txtHeaders only contains metadata and the operation location. The OCR completion status comes from the results.Status in the GetReadResultAsync response, not from txtHeaders. * D. Wrap the call to GetReadResultAsync within a loop that contains a delay * Correct. This is how you poll until the operation has finished. Option Analysis The answer: B and D * Azure Computer Vision Read API * Read text using the Computer Vision client library Microsoft References