Skip to content

Commit

Permalink
Disabled non-text output formats by default per #916
Browse files Browse the repository at this point in the history
  • Loading branch information
Balearica committed Dec 24, 2024
1 parent e2e8e3b commit c1ff5d1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
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

0 comments on commit c1ff5d1

Please sign in to comment.