naptha / tesseract.js

Pure Javascript OCR for more than 100 Languages 📖🎉🖥
http://tesseract.projectnaptha.com/
Apache License 2.0
35.31k stars 2.23k forks source link

Tesseract development version server throws 404 on localhost:3000 #874

Closed Kishlay-notabot closed 10 months ago

Kishlay-notabot commented 10 months ago

Tesseract.js version (version number for npm/GitHub release, or specific commit for repo) Latest version 5.0.4

Describe the bug A clear and concise description of what the bug is. After cloning the repo, running npm install and then npm start, the command line shows up successful outputs but when I open the server link at http://localhost:3000/examples/browser/demo.html

To Reproduce Steps to reproduce the behavior:

  1. Clone the repo
  2. Run npm install
  3. Run npm start
  4. Open localhost link

Expected behavior Locahost dev server running succesfully

Device Version:

Kishlay-notabot commented 10 months ago

Running tesseract locally is getting very confusing. In the docs I read about the dev server, and when i read the code I see mentions of the dist directory, but there is no dist directory to be seen.
Edit: dist directory seems to be in the CDN, sorry but im still confused Someone please guide me and clear this fog over this, how to run tesseract independently, offline and please clear up all the mess of these different versions, node, browser and vanilla js [I've been using vanilla directly in npm and there seems to be no issue running the program, but in order to get a front end, I have to incorporate the html code]

Kishlay-notabot commented 10 months ago

When I run tesseract using npm installation [basic node app (see code below)] and use a simple js only script, it downloads the respective .traineddata in the same folder,

const Ts = require("tesseract.js");

Ts.recognize('./tss.jpg', 'hin', {
  logger: e => console.log(e),
  tessedit_pageseg_mode: Ts.PSM.SINGLE_CHAR,
})
  .then(out => console.log(out))

but when we use browser mode, does the processing and unpacking happen in the cdn? Am i right?

Balearica commented 10 months ago

This repo contains multiple examples, for both browser and Node.js. If you are having trouble getting started you should start by running those.

If you want to run Tesseract.js recognition entirely from your local server and/or local system, without trying to access a CDN, review the instructions in the documentation here.

The demo.html file your original post mentions does not exist, as it was replaced with other examples. I will update the documentation to remove any remaining references to this file now to avoid future confusion.

Kishlay-notabot commented 10 months ago

This repo contains multiple examples, for both browser and Node.js. If you are having trouble getting started you should start by running those.

If you want to run Tesseract.js recognition entirely from your local server and/or local system, without trying to access a CDN, review the instructions in the documentation here.

The demo.html file your original post mentions does not exist, as it was replaced with other examples. I will update the documentation to remove any remaining references to this file now to avoid future confusion.

I did check the documentation and the examples, i tried to run the server, it it throwed up the cannot get error. Thanks anyway, I'll recheck the links you have provided.

Kishlay-notabot commented 10 months ago

The demo.html file your original post mentions does not exist, as it was replaced with other examples. I will update the documentation to remove any remaining references to this file now to avoid future confusion.

The documentation mentioned that specific link, yes.

And,

This repo contains multiple examples, for both browser and Node.js. If you are having trouble getting started you should start by running those.

I did read these links, but where specifically is the /dist/ directory located?

Kishlay-notabot commented 10 months ago

Edit: the repo got updated, I'll try running it again. If it works, I'll close the issue

Balearica commented 10 months ago

I did read these links, but where specifically is the /dist/ directory located? Where can I download the JS file package

Run npm run build to build the static files in the dist directory. This also happens automatically if you run npm start.

The example codes successfully work for the node installation, but I am facing trouble running it locally, and there is no proper or updated series of steps mentioned in the readme files to do it.

I do not understand what you mean by saying that the example code works but you were not able to run it locally.

Kishlay-notabot commented 10 months ago

I did read these links, but where specifically is the /dist/ directory located? Where can I download the JS file package

Run npm run build to build the static files in the dist directory. This also happens automatically if you run npm start.

The example codes successfully work for the node installation, but I am facing trouble running it locally, and there is no proper or updated series of steps mentioned in the readme files to do it.

I do not understand what you mean by saying that the example code works but you were not able to run it locally.

Sorry, I did not realize that Node version is also technically locally run . And yes thanks the local browser environment server now works.

Earlier I failed to realize that actually both are same.