code ing
This commit is contained in:
parent
718f23bba5
commit
9af1b244d3
2 changed files with 16 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "misskey",
|
||||
"version": "12.118.1-calc.rc.4.6",
|
||||
"version": "12.118.1-calc.rc.4.7",
|
||||
"codename": "aqua",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -146,16 +146,21 @@ export default defineComponent({
|
|||
|
||||
caption: async () => {
|
||||
const img = document.getElementById('imgtocaption') as HTMLImageElement;
|
||||
const imgurl = img.src;
|
||||
await worker.load();
|
||||
await worker.loadLanguage('eng');
|
||||
await worker.initialize('eng');
|
||||
const { data: { text } } = await worker.recognize(imgurl);
|
||||
console.log(text);
|
||||
// document.getElementById('recognized-text').innerText = text;
|
||||
// const allowedLength = 512 - this.inputValue.length;
|
||||
// this.inputValue += text.slice(0, allowedLength);
|
||||
await worker.terminate();
|
||||
fetch(img.src)
|
||||
.then((response) => {
|
||||
return response.blob();
|
||||
})
|
||||
.then((blob) => {
|
||||
worker.load();
|
||||
worker.loadLanguage('eng');
|
||||
worker.initialize('eng');
|
||||
const { data: { text } } = worker.recognize(blob);
|
||||
console.log(text);
|
||||
// document.getElementById('recognized-text').innerText = text;
|
||||
// const allowedLength = 512 - this.inputValue.length;
|
||||
// this.inputValue += text.slice(0, allowedLength);
|
||||
worker.terminate();
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue