Giter VIP home page Giter VIP logo

yav-ai / nodejs-stable-diffusion-xl-base-1.0-hugging-face-inference-api Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 304 KB

A simple node.js example that generates an image using StableDiffusion via Hugging Face Inference API.

License: MIT License

JavaScript 100.00%
ai generative-ai huggingface image-generation inference-api nodejs nodejsexamples sdxl stable-diffusion stable-diffusion-api

nodejs-stable-diffusion-xl-base-1.0-hugging-face-inference-api's Introduction

NodeJS example: Stable Diffusion using Hugging Face Inference API

Installation

To set up and run this example, follow these steps:

  1. Clone this repo.

  2. Navigate to the project directory.

  3. 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.

  4. Install the required Node.js packages by running the following command:

    npm install

How to use?

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

Examples

Further reading

https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0
https://huggingface.co/docs/api-inference/index
https://huggingface.co/docs/inference-endpoints/index

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.