I'm trying to develop a mobile app that uses a Free OCR REST API (https://freeocrapi.com/).
Yet I'm having difficulties in passing the camera image to the API request.
The site suggests the following curl example:
curl -F "file=@test.jpg" https://freeocrapi.com/api
The same request in PHP:
$filename = 'test.jpg';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://freeocrapi.com/api',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('file'=> new CURLFILE($filename))));
$response = curl_exec($curl);
curl_close($curl)
;echo $response;
And the python example:
import requests
url = "https://freeocrapi.com/api"
filename = "test.jpg"
data = {'file': open(filename, 'rb')}
response = requests.request("POST", url, files=data)
print(response.text)
What's the best way to use the Service Studio REST Console to supply the camera's images?
Hi Jose,
FreeOCRAPI.com does not have any dedicated guide on utilizing its REST API.
If you are trying to use a free API to process OCR functionality, I would suggest you to try https://ocr.space/
You can access the below forge component for the same. Use Try Now to see the functionality in action.
https://www.outsystems.com/forge/component-overview/13681/ocr-space
Hope this resolves the issue you are facing or the functionality you are trying to implement.
Thank you Somesh. The component that you suggest fits perfectly.