actually fix this time?

This commit is contained in:
ThatOneCalculator 2022-08-08 17:51:18 -07:00
parent 70484a011c
commit 58ff242241
2 changed files with 20 additions and 20 deletions

View file

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

View file

@ -33,16 +33,12 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { length } from 'stringz';
import { createWorker } from 'tesseract.js';
import Tesseract from 'tesseract.js';
import MkModal from '@/components/ui/modal.vue';
import MkButton from '@/components/ui/button.vue';
import bytes from '@/filters/bytes';
import number from '@/filters/number';
const worker = createWorker({
logger: m => console.log(m),
});
export default defineComponent({
components: {
MkModal,
@ -144,20 +140,24 @@ export default defineComponent({
}
},
caption: async () => {
const img = document.getElementById('imgtocaption') as HTMLImageElement;
const imgurl = img.src;
console.log(imgurl)
const imgblob = await fetch(imgurl).then(r => r.blob());
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
const { data: { text } } = await worker.recognize(imgblob);
console.log(text);
// document.getElementById('recognized-text').innerText = text;
// const allowedLength = 512 - this.inputValue.length;
// this.inputValue += text.slice(0, allowedLength);
await worker.terminate();
caption() {
const img = document.getElementById('imgtocaption');
Tesseract.recognize(
img,
'eng',
{ logger: m => console.log(m) },
).then(({ data: { text } }) => {
console.log(text);
});
// await worker.load();
// await worker.loadLanguage('eng');
// await worker.initialize('eng');
// const { data: { text } } = await worker.recognize(img);
// console.log(text);
// // document.getElementById('recognized-text').innerText = text;
// // const allowedLength = 512 - this.inputValue.length;
// // this.inputValue += text.slice(0, allowedLength);
// await worker.terminate();
},
},
});