From 8978faa04ac96bd388cb2c65e413fdd5cf404d04 Mon Sep 17 00:00:00 2001 From: jeromewu Date: Fri, 10 May 2019 08:58:15 +0800 Subject: [PATCH] Update usage from v1 to v2 --- demo.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/demo.js b/demo.js index be9d7ab..0eede00 100644 --- a/demo.js +++ b/demo.js @@ -25,6 +25,8 @@ var lang_drop_instructions = { rus: 'a Russian' } +var tessWorker = new Tessearct.TesseractWorker(); + function setUp(){ input_overlay.width = input.naturalWidth input_overlay.height = input.naturalHeight @@ -48,7 +50,7 @@ function startDemo(){ demoStarted = true function start(){ - Tesseract.recognize(input) + tessWorker.recognize(input) .progress(progressUpdate) .then(result) @@ -158,7 +160,7 @@ function clearOverLayAndOutput(){ // output.addEventListener('click', function play(){ // output.removeEventListener('click', play) -// Tesseract.recognize(input, lang) +// tessWorker.recognize(input, lang) // .progress( progress ) // .then( result ) // }) @@ -172,7 +174,7 @@ function play(){ output_text.innerHTML = '' // output_overlay.innerHTML = '' - Tesseract.recognize(input, language) + tessWorker.recognize(input, language) .progress( progressUpdate ) .then( result ) } @@ -205,7 +207,7 @@ document.body.addEventListener('drop', function(e){ var file = e.dataTransfer.files[0] var reader = new FileReader(); - Tesseract.recognize(file, language) + tessWorker.recognize(file, language) .progress( progressUpdate ) .then( result ) @@ -218,4 +220,4 @@ document.body.addEventListener('drop', function(e){ } } reader.readAsDataURL(file); -}) \ No newline at end of file +})