Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled non-text output formats by default per #916 #983

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/node/memory-benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const workerGen = async () => {
const promises = [];
for (let j = 0; j < 10; j++) {
// Results are purposefully not saved as this would increase memory usage over time.
promises.push(scheduler.addJob('recognize', file).then(() => (true)));
promises.push(scheduler.addJob('recognize', file, {}, { blocks: true }).then(() => (true)));
}
// eslint-disable-next-line no-await-in-loop
await Promise.all(promises);
Expand Down
3 changes: 2 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ Figures out what words are in `image`, where the words are in `image`, etc.
- `image` see [Image Format](./image-format.md) for more details.
- `options` an object of customized options
- `rectangle` an object to specify the regions you want to recognized in the image, should contain top, left, width and height, see example below.
- `output` an object specifying which output formats to return (by default `text`, `blocks`, `hocr`, and `tsv` are returned)
- `output` an object specifying which output formats to return (by default only `text` is returned)
- Other options include `blocks` (json), `hocr`, and `tsv`
- `jobId` Please see details above

**Output:**
Expand Down
2 changes: 1 addition & 1 deletion src/createWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ module.exports = async (langs = 'eng', oem = OEM.LSTM_ONLY, _options = {}, confi
);

const recognize = async (image, opts = {}, output = {
blocks: true, text: true, hocr: true, tsv: true,
text: true,
}, jobId) => (
startJob(createJob({
id: jobId,
Expand Down
6 changes: 3 additions & 3 deletions src/worker-script/constants/defaultOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

module.exports = {
text: true,
blocks: true,
blocks: false,
layoutBlocks: false,
hocr: true,
tsv: true,
hocr: false,
tsv: false,
box: false,
unlv: false,
osd: false,
Expand Down
Loading