HttpPost httppost = new HttpPost("http://localhost:8010/ocr-api/");
FileBody bin = new FileBody(new File("E:\\OCR\\2233373112.jpg"));
StringBody comment = new StringBody("A binary file of some kind", ContentType.TEXT_PLAIN);
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addPart("file", bin)
.addPart("comment", comment)
.build();
httppost.setEntity(reqEntity);
CloseableHttpResponse response = httpclient.execute(httppost);
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
List<String> readLines = IOUtils.readLines(resEntity.getContent(), OcrApiUtils.UTF8);
System.out.println("Response content length: " + resEntity.getContentLength());
System.out.println(ListUtils.toString(readLines));
}
EntityUtils.consume(resEntity);
} finally {
response.close();
}
-
Notifications
You must be signed in to change notification settings - Fork 0
ekoz/ocr-api
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Ocr Api with Tesseract-ocr
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published