How to Set Up and Use ArtBot for Stable Diffusion

Jun 8, 2021 | Data Science

ArtBot is a fantastic tool that allows you to interact seamlessly with the Stable Horde cluster, making it easy to generate beautiful AI artwork. In this guide, we’ll walk you through the setup, usage, and troubleshooting of ArtBot, along with some helpful tips for common issues.

Table of Contents

Intro

ArtBot is an unofficial front-end web client designed for interacting with the Stable Horde distributed cluster. It uses the processing power of donated GPUs from a vibrant community to run Stable Diffusion. Built using Next.js 13 and Typescript, ArtBot offers a clean, custom-built interface using Styled Components and Tailwind CSS. The UI is designed for ease of use while storing AI-generated images securely in your browser.

Setup

Requirements

  • Node.js version: 18.0.0
  • NPM version: 9.0.0

While these steps work across Linux, MacOS, and Windows, installing different Node.js versions can be tricky. A helpful tool here is nvm, which allows you to manage multiple Node.js versions seamlessly.

Installing

With Node.js set up, follow these steps:

git clone https://github.com/daveschumaker/artbot-for-stable-diffusion
cd artbot-for-stable-diffusion
npm install

Your machine’s specifications and internet speed may affect installation time. Be patient!

Environmental Variables

A post-installation script will generate a blank .env file in your project root. This file is crucial for the dotenv package, so ensure it exists. Although not mandatory, the code references some environmental variables related to messaging, telemetry services, and local data storage.

Usage

Development

To start the web app in development mode, use the following command:

npm run dev

This mode includes hot-reloading, allowing you to see updates live as you make changes. After running the command, open your browser and visit http://localhost:3000. For quicker image generation, input your Stable Horde API key at http://localhost:3000/artbot/settings.

Production

To run ArtBot in a production environment, you need to build the app first. Execute the following commands:

npm run build
npm run start

I use PM2 to manage the application on TinyBots, enabling it to restart automatically after crashes or server reboots. PM2 settings can be modified inside ecosystem.config.js.

npm run pm2:start-prod
npm run pm2:stop-prod

Troubleshooting

Windows Issues

Running the app on Windows can cause problems due to how environment variables are managed. To solve this:

  1. Open package.json.
  2. Modify the scripts.dev line to remove PORT=3000:
  3. npm run update:build-id  node server.js
  4. Save package.json and run again:
  5. npm run dev

This should resolve the issue, allowing the web app to default to port 3000, set automatically in server.js.

Other Issues

If you encounter other issues not covered, don’t hesitate to open a new issue on GitHub or join the ArtBot feedback channel on the Stable Horde Discord server.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Contributions

We welcome contributions! If you want to help improve ArtBot, just:

  1. Fork the repository.
  2. Cut a new feature branch (e.g., git checkout -b my-cool-new-feature).
  3. Make the necessary changes.
  4. Open a new pull request.

If you have any questions, feel free to reach out. I’m here to help!

License

For licensing information, please check LICENSE.md.

Analogy for Understanding the Code Flow

Think of ArtBot like a restaurant where you place an order for a dish from the menu (the image you want). When you enter the restaurant (run the application), the server (Next.js) takes your order (the API request), then passes it to the kitchen (Stable Horde’s GPUs) to prepare your dish. As the chef prepares it, you can tweak the order in real-time (thanks to hot-reloading) until you’re satisfied with your meal. After the meal is prepared, it’s served to you at your table (the browser), ready for you to enjoy!

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox