NodeJS Stable Diffusion XL Base 1.0 Hugging Face Inference API
1.0.0
To set up and run this example, follow these steps:
Clone this repo.
Navigate to the project directory.
Open index.mjs
Replace "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
in the code with your Hugging Face API token. You can obtain an API token by signing up on the Hugging Face website.
Install the required Node.js packages by running the following command:
npm install
Open index.mjs and change your image caption
generateImage("photo of rocket launching into space");
Open terminal and run
node index.mjs
Once the image is processed, it will return
Image saved to: output/photo-of-rocket-launching-into-space.png
https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0
https://huggingface.co/docs/api-inference/index
https://huggingface.co/docs/inference-endpoints/index