使用 Azure.AI.FormRecognizer 1.0.0-preview.2 并尝试上传文件,然后对其运行表单识别。代码是
var fileName = Path.Combine(@"c:\temp\", sourceFile.FileName);
var fileUri = new Uri(fileName);
sourceFile.SaveAs(fileName);
var forms = await recogClient.StartRecognizeCustomFormsFromUri(modelId, fileUri).WaitForCompletionAsync();
例如,文件 URI 变为file:///c:/temp/DC002.pdf
我认为是有效的 URI。但是,在运行时StartRecognizeCustomFormsFromUri
,我收到错误:
Service request failed. Status: 400 (Bad Request) Content: {"error":{"code":"1003","message":"Parameter 'Source' is not a valid Uri."}} Headers: Transfer-Encoding: chunked x-envoy-upstream-service-time: REDACTED apim-request-id: REDACTED Strict-Transport-Security: REDACTED x-content-type-options: REDACTED Date: Wed, 27 May 2020 12:30:01 GMT Content-Type: application/json; charset=utf-8