- Install Node.js (v18 recommended, check by running
node -v
in your terminal) - Install a code editor
- We recommend Visual Studio Code
- Clone or download this project
- Download: https://github.com/pixelbar/nodeschool-ai/archive/refs/heads/main.zip
- Clone:
git clone https://github.com/pixelbar/nodeschool-ai.git
- Open the cloned directory in your code editor
- Install dependencies
- Run in cloned directory:
npm install
- Run in cloned directory:
- Download models
- If you're at Pixelbar, go to: http://172.16.31.216/ and download
t5-base.zip
andvit-base-patch16-224.zip
, unzip them, and put them (the whole folder, not just the contents) in themodels/Xenova
folder. - If you're not at Pixelbar, set
allowRemoteModels
inapp.js
totrue
to allow models to be downloaded at runtime.
- If you're at Pixelbar, go to: http://172.16.31.216/ and download
- If you want to use OpenAI, create an account at https://openai.com. You get $5 of free credits to be used in the first 3 months.
- Create an API key: https://platform.openai.com/account/api-keys
- Copy
.env.example
to.env
and fill in the values
- Run the app:
node app.js
Note that Transformers.js is limited in that it can only run models that have been converted to a special format (ONNX). You can find all models compatible with Transformers.js here: https://huggingface.co/models?library=transformers.js&sort=downloads.
- Express documentation - Express is the framework that the application is built on
- Transformers.js documentation - Transformers.js is a library to run machine learning models from Hugging Face on Node.js and the web
- Hugging Face Tasks - explore ML models for various specific tasks
- OpenAI API reference
- GPT best practices - best practices for prompting OpenAI GPT APIs
- OpenAI chat playground - playground to interact with Chat Completion API