Page 1 of 1

HOW TO IMPLEMENT the OCR API.

Posted: Sat Mar 14, 2015 6:27 am
by Ahmet

Hi, I was looking for a OCR solution, I have found OCRAPISERVICE.COM .
But they provide solutions for ANDROID, IPHONE and WINPHONE but not a API for APPERY.IO. so the question is HOW can I implement this solution in APPERY.IO? Can you help me please? please see "www.ocrapiservice.com"


HOW TO IMPLEMENT the OCR API.

Posted: Sat Mar 14, 2015 8:00 am
by Illya Stepanov

Hi Ahmet -

Appery.io is basically a web app, so if they provide such services API for a web app, then you can use it in Appery.io.


HOW TO IMPLEMENT the OCR API.

Posted: Sat Mar 14, 2015 9:59 pm
by Ahmet

Hi,

This is what OCRAPISERVICE.co provides:

This API is created for agile business using modern technologies and best practices. We avoided to use heavy web based on soap and xml. Our service uses an easy to use RESTful compliant API. Our system is able to interact with any system, including :
-Smartphones (iPhone, iPad, Android, Blackberry, etc...)
-Ajax based web applications (jQuery, PhoneGap, MooTools, Prototype, ASP.NET AJAX, Dojo, etc.)
-Web applications (php, asp.net, java enterprise edition, ruby on rails, etc.)
-Rich clients (C#, java, python, flash, etc.)

Our goal is to provide you the easiest but also the most powerful API to let you build your applications in a flash !

My question is:

Which of this options is best to use in combination with APPARY, and secondly Do they need to deliver something else besides the mentioned options.


HOW TO IMPLEMENT the OCR API.

Posted: Sun Mar 15, 2015 7:57 am
by Illya Stepanov

Hi Ahmet -

If the service provider has an RESTful API then you can use it in Appery.io.

Here is our documentation about REST service in Appery.io -- http://devcenter.appery.io/documentat...

And you can try our tutorials before implementing your service - http://devcenter.appery.io/tutorials/...

And check our video here -- https://youtu.be/HkOV5IzZivM


HOW TO IMPLEMENT the OCR API.

Posted: Mon Apr 20, 2015 12:44 pm
by Ahmet

Hi Illya,

I did what you described, and I can now put the photo taken by the camera in Appery.io databse with the first step.

Scondly I want to show the photo on screen, that is not done yet, no success untill now,

Third: how can I use the foto which is taken by the user for calling the OCR API?
This is also not successfull yet.

Here is my code for taking a PHOTO:

//M. Brodina (Official Rep) 1 year ago
//1) Add Camera service to project
//2) Add Camera Service on screen
//3) In Camera service settings specify destinationType = File URI
//4) Invoke service on some event
//5) On Camera service success event run the following code
function win(r) {
alert("Code = " + r.responseCode);
alert("Response = " + r.response);
alert("Sent = " + r.bytesSent);

Code: Select all

 var str3= r.response; 

var  teller=str3.indexOf('https'); 

alert ("teller=" +teller);

Code: Select all

 ResultStr = r.response; 

  if (ResultStr != null)    // Get the right FILE NAME out!!! thsi should be str9!!!, An easier way known ???  
  { 

      var SplitChars = 'filename":"'; 

     if (ResultStr.indexOf(SplitChars) = 0)  
     { 

         var DtlStr = ResultStr.split(SplitChars); 

         var str1  = DtlStr[0]; 
         var str2 = DtlStr[1]; 
         var str3 ="https" + str2; 
         var SplitChars2 = 'fileurl":"'; 
         var DtlStr2 = street.split(SplitChars2); 
         var str4  = DtlStr2[0]; 
         var str5 = DtlStr2[1]; 
         var str6 ="https" + str5; 
         var SplitChars3 = '"}'; 
         var DtlStr3 = street2.split(SplitChars3); 
         var str7  ='"'+ DtlStr3[0] +'"'; 
         var str8 = DtlStr3[1]; 

         alert("str8 = " + str8); 

         var str9 ="https" + str9; 
         alert("str9 = " + str9); 
     } 

 } 

}
function fail(error) {
alert("An error has occurred: Code = " + error.code);
alert("upload error source " + error.source);
alert("upload error target " + error.target);
}
var fileURI = data.imageURI;
var headers = {
'X-Appery-Database-Id': 'XXXXXXXXXXXXXXXX',
'X-Appery-Session-Token': localStorage.getItem("_sessiontoken")
};
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);
options.mimeType = 'image/jpeg';
options.headers = headers;
var uri = encodeURI("https://api.appery.io/rest/1/db/files/" + options.fileName);

var uri2= "https://api.appery.io/rest/1/db/files/" + options.fileName;

//alert ("uri2:", uri2);

var ft = new FileTransfer();
ft.upload(fileURI, uri, win, fail, options);

--------------------

So upload wrks, and I can get the username from the code above, I think at step 9: str9 = "THE FILE NAME I needed to dsplay on screen correct?

  1. How can I use The filename of the photo taken by the user for OCR call which is:

    function uploadFiles(url, files) {
    console.log(url, files);
    console.log('sending data');
    var formData = new FormData();

    formData.append('image', files[0]);
    formData.append('language', 'fr');

    formData.append('apikey', 'wXXXXX');

    var xhr = new XMLHttpRequest();
    xhr.open('POST', url, true);

    $('.translation_text').text('Translating. Please wait ... ');

    xhr.onload = function(e) {
    console.log(this.response);
    $('.translation_text').text(this.response);
    };

    xhr.send(formData);
    }

    What should be the parameters for the function: uploadFiles(XXX,YYY) ?

    what are XXX and YYYY?

    Thanks
    Ahmet


HOW TO IMPLEMENT the OCR API.

Posted: Sat Apr 25, 2015 8:32 pm
by Illya Stepanov

Ahmet -

Have you solved this issue, or you need our assistance here?