Browse Source

Update usage from v1 to v2

pull/389/head
jeromewu 6 years ago committed by GitHub
parent
commit
8978faa04a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      demo.js

12
demo.js

@ -25,6 +25,8 @@ var lang_drop_instructions = {
rus: 'a Russian' rus: 'a Russian'
} }
var tessWorker = new Tessearct.TesseractWorker();
function setUp(){ function setUp(){
input_overlay.width = input.naturalWidth input_overlay.width = input.naturalWidth
input_overlay.height = input.naturalHeight input_overlay.height = input.naturalHeight
@ -48,7 +50,7 @@ function startDemo(){
demoStarted = true demoStarted = true
function start(){ function start(){
Tesseract.recognize(input) tessWorker.recognize(input)
.progress(progressUpdate) .progress(progressUpdate)
.then(result) .then(result)
@ -158,7 +160,7 @@ function clearOverLayAndOutput(){
// output.addEventListener('click', function play(){ // output.addEventListener('click', function play(){
// output.removeEventListener('click', play) // output.removeEventListener('click', play)
// Tesseract.recognize(input, lang) // tessWorker.recognize(input, lang)
// .progress( progress ) // .progress( progress )
// .then( result ) // .then( result )
// }) // })
@ -172,7 +174,7 @@ function play(){
output_text.innerHTML = '' output_text.innerHTML = ''
// output_overlay.innerHTML = '' // output_overlay.innerHTML = ''
Tesseract.recognize(input, language) tessWorker.recognize(input, language)
.progress( progressUpdate ) .progress( progressUpdate )
.then( result ) .then( result )
} }
@ -205,7 +207,7 @@ document.body.addEventListener('drop', function(e){
var file = e.dataTransfer.files[0] var file = e.dataTransfer.files[0]
var reader = new FileReader(); var reader = new FileReader();
Tesseract.recognize(file, language) tessWorker.recognize(file, language)
.progress( progressUpdate ) .progress( progressUpdate )
.then( result ) .then( result )
@ -218,4 +220,4 @@ document.body.addEventListener('drop', function(e){
} }
} }
reader.readAsDataURL(file); reader.readAsDataURL(file);
}) })

Loading…
Cancel
Save