This commit is contained in:
ThatOneCalculator 2022-08-08 17:43:18 -07:00
parent 9af1b244d3
commit 5a59eb9838
2 changed files with 13 additions and 16 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "misskey", "name": "misskey",
"version": "12.118.1-calc.rc.4.7", "version": "12.118.1-calc.rc.4.8",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -146,21 +146,18 @@ export default defineComponent({
caption: async () => { caption: async () => {
const img = document.getElementById('imgtocaption') as HTMLImageElement; const img = document.getElementById('imgtocaption') as HTMLImageElement;
fetch(img.src) const imgurl = img.src;
.then((response) => { console.log(imgurl)
return response.blob(); const imgblob = await fetch(imgurl).then(r => r.blob());
}) await worker.load();
.then((blob) => { await worker.loadLanguage('eng');
worker.load(); await worker.initialize('eng');
worker.loadLanguage('eng'); const { data: { text } } = await worker.recognize(imgblob);
worker.initialize('eng'); console.log(text);
const { data: { text } } = worker.recognize(blob); // document.getElementById('recognized-text').innerText = text;
console.log(text); // const allowedLength = 512 - this.inputValue.length;
// document.getElementById('recognized-text').innerText = text; // this.inputValue += text.slice(0, allowedLength);
// const allowedLength = 512 - this.inputValue.length; await worker.terminate();
// this.inputValue += text.slice(0, allowedLength);
worker.terminate();
});
}, },
}, },
}); });