Function for extracting text from images. It sends a request to the Image Extraction AI Model and returns the extracted text. Read more about the Models and their use cases at: https://docs.worqhat.com/ai-models/text-extraction/image-extraction

Parameters

ParameterTypeDescriptionDefault
imageFile or stringThe existing image to extract data from. It can be a File object or a URL or base64 encoded image data. This is a required parameter.
output_formatstringThe output format of the extracted text. Can be text or json.text

Initialize AI Modules

const worqhat = require('worqhat');

var config = new worqhat.Configuration({
    apiKey: "your-api-key",
    debug: true,
    max_retries: 3,
});

worqhat.initializeApp(config);

let ai = worqhat.ai();

Implementation

ai.textExtraction.image({
    image: "./image.jpeg",
    output_format: "text"
}).then((response) => {
    console.log(response);
}).catch((error) => {
    console.log(error);
});