loretoparisi / fasttext.js

FastText for Node.js
MIT License
192 stars 28 forks source link

ERROR: Cannot run server #7

Closed KangHyeongMin closed 6 years ago

KangHyeongMin commented 6 years ago

Steps to reproduce

  1. Clone project
  2. Run train $ node examples/train.js
  3. Run server $ node examples/server.js

Expected behaviour

Server starting with below message

model loaded
server is listening on 3000

Actual behaviour

Fail to start server with below message

events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at exports._errnoException (util.js:1024:11)
    at WriteWrap.afterWrite [as oncomplete] (net.js:851:14)

I wll fix and make PR

loretoparisi commented 6 years ago

@KangHyeongMin thanks for point this out. I have also updated the docs in the case you want to serve a specific model:

$ cd examples/
$ export MODEL=data/lid.176.ftz
$ node server.js 
model loaded
server is listening on 3000

Basically you have to export the MODEL env to point to the model to load, after that you should be able to call http://localhost:3000/?text=LBi%20Software%20provides%20precisely%20engineered,%20customer-focused%20#HRTECH

loretoparisi commented 6 years ago

Closing this then since fixed by PR https://github.com/loretoparisi/fasttext.js/pull/8