|
|
@ -5,11 +5,11 @@ |
|
|
|
* Copyright 2020 Harish.K<harish2704@gmail.com> |
|
|
|
*/ |
|
|
|
|
|
|
|
function ocrByServer(image) { |
|
|
|
function ocrByServer(image, opts) { |
|
|
|
var data = new FormData(); |
|
|
|
data.append("image", image); |
|
|
|
return fetch( |
|
|
|
"./ocr", |
|
|
|
"./ocr?lang="+opts.lang.join(':'), |
|
|
|
{ |
|
|
|
method: "POST", |
|
|
|
body: data, |
|
|
@ -28,11 +28,17 @@ new Vue({ |
|
|
|
currentFileBlob: null, |
|
|
|
isLoading: false, |
|
|
|
ocrOutput: "", |
|
|
|
availableLangs:[ |
|
|
|
{ label: 'Malayalam', code: 'mal' }, |
|
|
|
{ label: 'English', code: 'eng' }, |
|
|
|
{ label: 'Hindi', code: 'hin' }, |
|
|
|
], |
|
|
|
selectedLangs:['mal'] |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
doOcr: function () { |
|
|
|
this.isLoading = true; |
|
|
|
ocrByServer(this.currentFileBlob) |
|
|
|
ocrByServer(this.currentFileBlob, { lang: this.selectedLangs }) |
|
|
|
.then((data) => { |
|
|
|
console.log("success", data); |
|
|
|
this.ocrOutput = data.text; |
|
|
|