This commit is contained in:
ThatOneCalculator 2022-08-08 17:14:10 -07:00
parent a21698b1b2
commit b7f00ea40a
2 changed files with 8 additions and 9 deletions

View File

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

View File

@ -31,7 +31,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { length } from 'stringz'; import { length } from 'stringz';
import { createWorker, PSM, OEM } from 'tesseract.js'; import { createWorker } from 'tesseract.js';
import MkModal from '@/components/ui/modal.vue'; import MkModal from '@/components/ui/modal.vue';
import MkButton from '@/components/ui/button.vue'; import MkButton from '@/components/ui/button.vue';
import bytes from '@/filters/bytes'; import bytes from '@/filters/bytes';
@ -145,17 +145,16 @@ export default defineComponent({
}, },
caption: async () => { caption: async () => {
const img = document.getElementById('imgtocaption'); const img = document.getElementById('imgtocaption') as HTMLImageElement;
const imgurl = img.src;
await worker.load(); await worker.load();
await worker.loadLanguage('eng'); await worker.loadLanguage('eng');
await worker.initialize('eng', OEM.LSTM_ONLY); await worker.initialize('eng');
await worker.setParameters({ const { data: { text } } = await worker.recognize(imgurl);
tessedit_pageseg_mode: PSM.SINGLE_BLOCK, console.log(`\n\n${text}\n\n`);
});
const { data: { text } } = await worker.recognize(img);
console.log(text);
const allowedLength = 512 - this.inputValue.length; const allowedLength = 512 - this.inputValue.length;
this.inputValue += text.slice(0, allowedLength); this.inputValue += text.slice(0, allowedLength);
await worker.terminate();
}, },
}, },
}); });