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 = { @@ -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(){ @@ -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(){ @@ -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(){ @@ -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){ @@ -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){ @@ -218,4 +220,4 @@ document.body.addEventListener('drop', function(e){
}
}
reader.readAsDataURL(file);
})
})

Loading…
Cancel
Save