actually fix this time?
This commit is contained in:
parent
70484a011c
commit
58ff242241
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "12.118.1-calc.rc.4.8",
|
"version": "12.118.1-calc.rc.4.9",
|
||||||
"codename": "aqua",
|
"codename": "aqua",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -33,16 +33,12 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { length } from 'stringz';
|
import { length } from 'stringz';
|
||||||
import { createWorker } from 'tesseract.js';
|
import Tesseract 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';
|
||||||
import number from '@/filters/number';
|
import number from '@/filters/number';
|
||||||
|
|
||||||
const worker = createWorker({
|
|
||||||
logger: m => console.log(m),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
MkModal,
|
MkModal,
|
||||||
|
@ -144,20 +140,24 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
caption: async () => {
|
caption() {
|
||||||
const img = document.getElementById('imgtocaption') as HTMLImageElement;
|
const img = document.getElementById('imgtocaption');
|
||||||
const imgurl = img.src;
|
Tesseract.recognize(
|
||||||
console.log(imgurl)
|
img,
|
||||||
const imgblob = await fetch(imgurl).then(r => r.blob());
|
'eng',
|
||||||
await worker.load();
|
{ logger: m => console.log(m) },
|
||||||
await worker.loadLanguage('eng');
|
).then(({ data: { text } }) => {
|
||||||
await worker.initialize('eng');
|
|
||||||
const { data: { text } } = await worker.recognize(imgblob);
|
|
||||||
console.log(text);
|
console.log(text);
|
||||||
// document.getElementById('recognized-text').innerText = text;
|
});
|
||||||
// const allowedLength = 512 - this.inputValue.length;
|
// await worker.load();
|
||||||
// this.inputValue += text.slice(0, allowedLength);
|
// await worker.loadLanguage('eng');
|
||||||
await worker.terminate();
|
// 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();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue