Skip to content

Commit

Permalink
Fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Balearica committed Aug 20, 2024
1 parent 90fe37e commit 68c9e0e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/containers/imageContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class ImageCache {
* @returns
*/
static #initMuPDFScheduler = async (numWorkers = 3) => {
const Tesseract = typeof process === 'undefined' ? (await import('../../tess/tesseract.esm.min.js')).default : await import('tesseract.js');
const Tesseract = typeof process === 'undefined' ? (await import('../../tess/tesseract.esm.min.js')).default : await import('@scribe.js/tesseract.js');
const scheduler = await Tesseract.createScheduler();
const workersPromiseArr = range(1, numWorkers).map(async () => {
const w = await initMuPDFWorker();
Expand Down
2 changes: 1 addition & 1 deletion js/generalWorkerMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class gs {
workerN = Math.min(Math.round((globalThis.navigator.hardwareConcurrency || 8) / 2), 6);
}

const Tesseract = typeof process === 'undefined' ? (await import('../tess/tesseract.esm.min.js')).default : await import('tesseract.js');
const Tesseract = typeof process === 'undefined' ? (await import('../tess/tesseract.esm.min.js')).default : await import('@scribe.js/tesseract.js');

gs.schedulerInner = await Tesseract.createScheduler();
gs.schedulerInner.workers = new Array(workerN);
Expand Down
2 changes: 1 addition & 1 deletion js/import/convertPageBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getTextScript } from '../utils/miscUtils.js';

/**
* @param {Object} params
* @param {Array<import('tesseract.js').Block>} params.ocrBlocks
* @param {Array<import('@scribe.js/tesseract.js').Block>} params.ocrBlocks
* @param {number} params.n
* @param {dims} params.pageDims
* @param {number} params.rotateAngle - The angle that the input image is rotated prior to recognition.
Expand Down
10 changes: 5 additions & 5 deletions js/worker/generalWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const recognizeAndConvert = async ({

const keepItalic = oemCurrent === 0;

const ocrBlocks = /** @type {Array<import('tesseract.js').Block>} */(res1.data.blocks);
const ocrBlocks = /** @type {Array<import('@scribe.js/tesseract.js').Block>} */(res1.data.blocks);

const res2 = await convertPageBlocks({
ocrBlocks, n, pageDims, rotateAngle: angle, keepItalic,
Expand Down Expand Up @@ -184,14 +184,14 @@ export const recognizeAndConvert2 = async ({
let resLegacy;
let resLSTM;
if (options.lstm && options.legacy) {
const legacyBlocks = /** @type {Array<import('tesseract.js').Block>} */(res0.data.blocks);
const legacyBlocks = /** @type {Array<import('@scribe.js/tesseract.js').Block>} */(res0.data.blocks);
resLegacy = await convertPageBlocks({
ocrBlocks: legacyBlocks, n, pageDims, rotateAngle: angle, keepItalic: true, upscale: options.upscale,
});
(async () => {
const res1 = await resArr[1];

const lstmBlocks = /** @type {Array<import('tesseract.js').Block>} */(res1.data.blocks);
const lstmBlocks = /** @type {Array<import('@scribe.js/tesseract.js').Block>} */(res1.data.blocks);
resLSTM = await convertPageBlocks({
ocrBlocks: lstmBlocks, n, pageDims, rotateAngle: angle, keepItalic: false, upscale: options.upscale,
});
Expand All @@ -201,12 +201,12 @@ export const recognizeAndConvert2 = async ({
postMessage({ data: xB, id: `${id}b` });
})();
} else if (!options.lstm && options.legacy) {
const legacyBlocks = /** @type {Array<import('tesseract.js').Block>} */(res0.data.blocks);
const legacyBlocks = /** @type {Array<import('@scribe.js/tesseract.js').Block>} */(res0.data.blocks);
resLegacy = await convertPageBlocks({
ocrBlocks: legacyBlocks, n, pageDims, rotateAngle: angle, keepItalic: true, upscale: options.upscale,
});
} else if (options.lstm && !options.legacy) {
const lstmBlocks = /** @type {Array<import('tesseract.js').Block>} */(res0.data.blocks);
const lstmBlocks = /** @type {Array<import('@scribe.js/tesseract.js').Block>} */(res0.data.blocks);
resLSTM = await convertPageBlocks({
ocrBlocks: lstmBlocks, n, pageDims, rotateAngle: angle, keepItalic: false, upscale: options.upscale,
});
Expand Down

0 comments on commit 68c9e0e

Please sign in to comment.