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
This is my App.js code when iam trying to run this iam getting this error "worker.load is not a fuction"!!
please resolve this !!
`import { useCallback, useEffect, useState } from 'react'; import { createWorker } from 'tesseract.js'; import './App.css';
function App() { const [selectedImage, setSelectedImage] = useState(null); const [textResult, setTextResult] = useState("");
const worker = createWorker();
const convertImageToText = useCallback(async () => { if(!selectedImage) return; await worker.load(); await worker.loadLanguage("eng"); await worker.initialize("eng"); const { data } = await worker.recognize(selectedImage); console.log(data) setTextResult(data.text); }, [worker, selectedImage]);
useEffect(() => { convertImageToText(); }, [selectedImage, convertImageToText])
const handleChangeImage = e => { if(e.target.files[0]) { setSelectedImage(e.target.files[0]); } else { setSelectedImage(null); setTextResult("") } } return (
Get words from image !!
<div className='result'> {selectedImage && ( <div className='box-image'> <img src={URL.createObjectURL(selectedImage)} alt="thumb" /> </div> )} {textResult && ( <div className='box-p'> <p>{textResult}</p> </div> )} </div> </div>
); }
export default App;`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This is my App.js code when iam trying to run this iam getting this error "worker.load is not a fuction"!!
please resolve this !!
`import { useCallback, useEffect, useState } from 'react';
import { createWorker } from 'tesseract.js';
import './App.css';
function App() {
const [selectedImage, setSelectedImage] = useState(null);
const [textResult, setTextResult] = useState("");
const worker = createWorker();
const convertImageToText = useCallback(async () => {
if(!selectedImage) return;
await worker.load();
await worker.loadLanguage("eng");
await worker.initialize("eng");
const { data } = await worker.recognize(selectedImage);
console.log(data)
setTextResult(data.text);
}, [worker, selectedImage]);
useEffect(() => {
convertImageToText();
}, [selectedImage, convertImageToText])
const handleChangeImage = e => {
if(e.target.files[0]) {
setSelectedImage(e.target.files[0]);
} else {
setSelectedImage(null);
setTextResult("")
}
}
return (
Image to Text
Get words from image !!
upload image
);
}
export default App;`
The text was updated successfully, but these errors were encountered: