mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 22:17:30 -07:00
im stuff
This commit is contained in:
parent
0797096062
commit
0b5c2f03ae
2 changed files with 8 additions and 9 deletions
|
@ -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",
|
||||||
|
|
|
@ -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();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue