![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
tesseract-ocr-golem
Advanced tools
Tesseract OCR library that executes the OCR on the Golem Network scaling to thousands of CPUs
OCR Images using Tesseract by leveraging Golem Network's computation resources.
convertImageToText
method.You can install this library using your favourite package manager:
npm install --save tesseract-ocr-golem
In order to run workloads on Golem Network, you need to join as a requestor. If you're working on a linux system, it's a simple bash-line. For more installation instructions, visit the Official JS SDK QuickStart.
curl -sSf https://join.golem.network/as-requestor | bash -
After installing Golem Network software (yagna
), you can obtain your API key which you will use with the library:
yagna app-key list
Here's an example of a working script that will allow you to send example images to OCR on the Golem Network using Tesseract OCR image.
import * as fs from "fs";
import { TesseractOcrOnGolem } from "tesseract-ocr-golem";
/**
* Utility used to write down results
*
* @param text The resulting text if any present
*/
const writeTextToResultFile = (text?: string) => {
if (text) {
fs.writeFileSync(`./examples/out/results.txt`, text, { flag: "a" });
}
};
(async () => {
const ocr = new TesseractOcrOnGolem({
service: {
market: {
rentHours: 0.5,
priceGlmPerHour: 1.0,
},
deploy: {
maxReplicas: 4,
resources: {
minCpuThreads: 2,
maxCpuThreads: 4,
},
downscaleIntervalSec: 60,
},
initTimeoutSec: 90,
requestStartTimeoutSec: 30,
},
args: {
lang: "eng",
},
});
try {
// Power-on the OCR, get the resources on Golem Network
// This will wait until the resources are found and the OCR is ready to use
await ocr.init();
// Do your work
console.log("Starting work for my customers...");
const texts = await Promise.all([
ocr.convertImageToText("./examples/data/img.png"),
ocr.convertImageToText("./examples/data/5W40s.png"),
ocr.convertImageToText("./examples/data/msword_text_rendering.png"),
ocr.convertImageToText("./examples/data/poem.png"),
]);
texts.forEach(writeTextToResultFile);
console.log("Work done, going to bill my customers...");
// TODO: Bill your customers ;)
} catch (err) {
console.error(err, "Failed to run the OCR on Golem");
} finally {
await ocr.shutdown();
}
})().catch((err) => console.error(err, "Error in main"));
Operating on the Golem Network requires
Env variable | Required | Default value | Description |
---|---|---|---|
GOLEM_API_KEY | yes | Yagna app-key used to identify your application | |
GOLEM_API_URL | no | http://localhost:7465 | Where is your yagna instance located |
GOLEM_PAYMENT_NETWORK | no | holesky | On which network you want to get the compute resources. polygon is the main network, where the real GLM tokens are used. holesky is the default test network. |
The config object accepted by TesseractOcrOnGolem
can be composed of 2 properties:
args
which control the default parameters which will be passed to tesseract
when running the OCR (see docs)service
which control the deployment of the OCR instances on the Golem Network (see docs)For details regarding specific config options, please refer to the API Documentation.
If you want to know what's going on inside the library, including logs from @golem-sdk/golem-js
you can use
the DEBUG
environment variable to see verbose logs. This library makes use of
the debug package to implement logs. If you want to fine-tune the log output,
please refer to the library's documentation.
Most of the time, such a line should suffice:
DEBUG="golem-js:*,golem,tesseract" GOLEM_API_KEY="your-api-key-to-yagna" npm run example
FAQs
Tesseract OCR library that executes the OCR on the Golem Network scaling to thousands of CPUs
The npm package tesseract-ocr-golem receives a total of 0 weekly downloads. As such, tesseract-ocr-golem popularity was classified as not popular.
We found that tesseract-ocr-golem demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.