nu-modules/ms-form.nu

19 lines
628 B
Plaintext

use std assert
export def comp-authority [] {
[
{ value: "http://10.54.150.152:5001", description: "internal ms ocr form recognizer" }
]
}
export def main [file:path, --authority:string@comp-authority] {
let authority = if $authority == $nothing {
assert ("MS_OCR_AUTHORITY" in $env) $"no authority specified. Use either an environment or spezify --host-name"
$env.MS_OCR_AUTHORITY
} else {
$authority
}
http post -H [content-type, application/octet-stream] $"($authority)/formrecognizer/documentModels/prebuilt-read:syncAnalyze?api-version=2022-08-31" (open $file)
}