We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug: I want to achieve fully offline use of tesseract.js, so I will:
const recognizeText = async (imageUrl: string) => { const worker = await Tesseract.createWorker("chi_sim", undefined, { workerPath: "/tessdata/tesseract.js/dist/worker.min.js", corePath: "/tessdata/tesseract.js-core", langPath: "/tessdata/tesseract-lang", logger: m => console.log(m), })
const { data: { text }, } = await worker.recognize(imageUrl) setRecognizedText(text) await worker.terminate() }
To Reproduce: Steps to reproduce the behavior:
Complete code const inputRefOCR = useRef(null) const [imageData, setImageData] = useState("") const [recognizedText, setRecognizedText] = useState("")
const handleCapture = () => { if (inputRefOCR.current.files && inputRefOCR.current.files.length > 0) { const file = inputRefOCR.current.files[0] const reader = new FileReader() reader.onload = e => { setImageData(e.target.result) recognizeText(e.target.result) } reader.readAsDataURL(file) } } const recognizeText = async (imageUrl: string) => { const worker = await Tesseract.createWorker( { workerPath: "/tessdata/tesseract.js/dist/worker.min.js", corePath: "/tessdata/tesseract.js-core", langPath: "/tessdata/tesseract-lang", logger: m => console.log(m), }) const { data: { text }, } = await worker.recognize(imageUrl) setRecognizedText(text) await worker.terminate() }
Console error display:
Expected behavior: Implement fully offline use of Tesseract.js
Device Version:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug:
I want to achieve fully offline use of tesseract.js, so I will:
const recognizeText = async (imageUrl: string) => {
const worker = await Tesseract.createWorker("chi_sim", undefined, {
workerPath: "/tessdata/tesseract.js/dist/worker.min.js",
corePath: "/tessdata/tesseract.js-core",
langPath: "/tessdata/tesseract-lang",
logger: m => console.log(m),
})
To Reproduce:
Steps to reproduce the behavior:
tesseract-lang、tesseract.js、tesseract.js-core
Complete code
const inputRefOCR = useRef(null)
const [imageData, setImageData] = useState("")
const [recognizedText, setRecognizedText] = useState("")
Console error display:
Expected behavior:
Implement fully offline use of Tesseract.js
Device Version:
The text was updated successfully, but these errors were encountered: