<script src=https://github.com/naptha/tesseract.js/issues/"https://code.jquery.com/ui/1.11.2/jquery-..."> <script src=https://github.com/naptha/tesseract.js/issues/"h..." /> <script src=https://github.com/naptha/tesseract.js/issues/"h..." />
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i would want to upgrade to 5.0.2 from 3.0.3 but i do not know how, can you please help me? #865

Closed
andrewtate512125 opened this issue Dec 24, 2023 · 1 comment

Comments

@andrewtate512125
Copy link

andrewtate512125 commented Dec 24, 2023

<script src=https://github.com/naptha/tesseract.js/issues/"https://code.jquery.com/ui/1.11.2/jquery-ui.js"> <script src='https://cdnjs.cloudflare.com/ajax/libs/tesseract.js/3.0.3/tesseract.min.js'></script> <script src=https://github.com/naptha/tesseract.js/issues/"nui://game/ui/jquery.js" type="text/javascript"></script> </head> <body> <script> $(document).ready(function(){ window.addEventListener('message', (event) => { if (event.data.action === `${GetParentResourceName()}:checkScreen`) { const worker = Tesseract.createWorker(); (async () => { await worker.load(); await worker.loadLanguage('eng'); await worker.initialize('eng'); await worker.setParameters({ tessedit_pageseg_mode: Tesseract.PSM.SPARSE_TEXT, tessedit_ocr_engine_mode: Tesseract.OEM.TESSERACT_LSTM_COMBINED }) const { data: { text } } = await worker.recognize(event.data.image); await worker.terminate(); fetch(`https://${GetParentResourceName()}/parsedText`, { method: 'POST', body: JSON.stringify({ image: event.data.image, text: await text }) }).catch((err) => {console.log(err)}); })(); } }); }) </script> </body> </html>">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="https://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/tesseract.js/3.0.3/tesseract.min.js'></script>
    <script src="nui://game/ui/jquery.js" type="text/javascript"></script>
</head>
<body>
    <script>
        $(document).ready(function(){
            window.addEventListener('message', (event) => {
                if (event.data.action === `${GetParentResourceName()}:checkScreen`) {
                    const worker = Tesseract.createWorker();
                    (async () => {
                        await worker.load();
                        await worker.loadLanguage('eng');
                        await worker.initialize('eng');
                        await worker.setParameters({
                            tessedit_pageseg_mode: Tesseract.PSM.SPARSE_TEXT,
                            tessedit_ocr_engine_mode: Tesseract.OEM.TESSERACT_LSTM_COMBINED
                        })

                        const { data: { text } } = await worker.recognize(event.data.image);
                        await worker.terminate();
                        fetch(`https://${GetParentResourceName()}/parsedText`, {
                            method: 'POST',
                            body: JSON.stringify({
                                image: event.data.image,
                                text: await text
                            })
                        }).catch((err) => {console.log(err)});
                    })();
                }     
            });
        })
    </script>
</body>
</html>
@Balearica
Copy link
Collaborator

The pinned issue #771 explains how to upgrade to the newest version. Please review that and let me know if anything is unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants