Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
File Input in JavaScript function for Tesseract.js

I have this website in which the User Inputs a file and then then the website returns in the console the text in the image. I use Tesseract.js, and the recognize function which has a file as parameter and string for language. Everything works fine when I put a sample file in manually in the function but want to know how to input a file that the users selects. How do I make the user file input in the recognize function? How do I replace "sample.PNG" with the user selected file?

Tesseract.recognize(
    "sample.PNG","eng",
    { 
      logger: m => console.log(m) 
    }
  )
  .catch (err => {
    console.error(err);
  })
  .then(result => {
   console.log(result);
  })
  
  
<html>
<head>
    <script src='https://unpkg.com/tesseract.js@v2.1.0/dist/tesseract.min.js'></script>
 <script src = "script.js"></script>
</head>
<input type="file" name="file" id="fileInput">
<button id = "">Submit</button>
</html>

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda