- # 测试 ocr classification
- # ddddocr.exe -a 127.0.0.1 -p 9898 --ocr
- # [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
- $webclient = New-Object System.Net.WebClient
- $webclient.Encoding = New-Object System.Text.UTF8Encoding -ArgumentList $false
- $dddd_url = 'http://127.0.0.1:9898/ocr/b64/text'
- # $dddd_url = 'http://127.0.0.1:9898/ocr_probability/b64/text'
- Get-ChildItem -Filter captcha*.* -File | ForEach-Object {
- $sjson = ConvertTo-Json @{image = [Convert]::ToBase64String([IO.File]::ReadAllBytes($_.FullName)) } -Compress
- $webclient.Headers.Add('Content-Type', 'application/json')
- $result = $webclient.UploadString($dddd_url, 'Post', $sjson)
- #$webclient.Encoding.GetString($result_bytes)
- $_ | Add-Member -MemberType NoteProperty -Name Captcha -Value $result -PassThru
- } | Format-List -Property Name, Captcha
-
- $webclient.Dispose()
复制代码
|