A. Uploading Model

  1. Come to Runpod website and go to secure cloud section. Choose a GPU. In this tutorial I am using 1x RTX A4500

Screenshot 2023-02-10 at 8.30.58 PM.png

  1. Under Select a Template, choose RunPod Stable Diffusion v2.1

    Screenshot 2023-02-10 at 9.07.13 PM.png

    Now we are ready to deploy

    Screenshot 2023-02-10 at 8.33.54 PM.png

    You may click on MyPods and see that the SD docker container has started building

    Screenshot 2023-02-10 at 8.34.15 PM.png

Screenshot 2023-02-10 at 8.34.29 PM.png

  1. Once its done, and the connect button gets enables, click on the CONNECT button

    Screenshot 2023-02-10 at 8.35.22 PM.png

    Click on the Start Web Terminal, and then click on Connect to Web Terminal

    Screenshot 2023-02-10 at 8.35.48 PM.png

    1. In the terminal, run the following commands, 1. cd models/Stable-diffusion

      b. try to copy & paste this into the terminal

      curl -c cookies.txt -s -L "https:drive.google.com/uc?export=download&id=1Gl_AQ05GTBLUyNDy1WJOVxgPMcpL5A3f" > /dev/null

      c. What are these doing? —Tippi

      curl -Lb cookies.txt "[<https://drive.google.com/uc?export=download&confirm=$>](<https://drive.google.com/uc?export=download&confirm=$>)(awk '/download/ {print $NF}' cookies.txt)&id=1Gl_AQ05GTBLUyNDy1WJOVxgPMcpL5A3f" -o DnDDragonbornGeneral.ckpt

      After this our model gets download

      Screenshot 2023-02-15 at 7.41.34 PM.png

      Yay! We have uploaded our model successfully! You can close the terminal window but don’t need to click Stop Web Terminal.

      B. Enabling SD-WebUI-Endpoints

      1. Go to Jupyter Lab

      Screenshot 2023-02-10 at 8.45.55 PM.png

      Make these changes in the webui-user.sh file:

      Untitled

      after --enable-insecure-extension-access add --api --cors-allow-origins=* before the last “

      make sure to uncomment # export REQS_FILE="requirements_versions.txt”

      make sure to uncomment # export REQS_FILE="requirements_versions.txt”

      Save the file.

      1. Now go back to the pod and stop it. After stopping, restart it and click on Connect via HTTP [Port 3000] to start the stable diffusion.

        Screenshot 2023-02-10 at 8.48.14 PM.png

      Our stable diffusion runpod has the custom DnDDragonbornGeneral model but we will have to load it manually by going to the connect to HTTP [port 3000] stable diffusion UI and change the model from the models dropdown menu.

      Screenshot 2023-02-15 at 8.16.51 PM.png

      stable diffusion takes a while to load the new weights,

      when it appears like this, then its completed loading

      Screenshot 2023-02-15 at 8.17.51 PM.png

      Ensure that you set height and width to 512 before you start using it.

      Screenshot 2023-02-15 at 8.18.42 PM.png

To connect to the api click here to learn more.

To learn more about Somya enabled this sdapi/v1/txt2img see this other documentation.

You can read the documentation of sd UI from “API” in the footer.

Screenshot 2023-02-15 at 8.20.14 PM.png

You can also try out the API from this “API” documentation section.

Screenshot 2023-02-15 at 8.22.00 PM.png

Using on the Front End

  1. Ensure the endpoint is up and running
  2. In your .env.local file, you’ll add the url that ends with sdapi/v1/txt2img as your SD_API_ENDPOINT. You’ll end up with something like this:
    1. SD_API_ENDPOINT=[<https://2lqotoget9y4le-3000.proxy.runpod.net/sdapi/v1/txt2img>](<https://2lqotoget9y4le-3000.proxy.runpod.net/sdapi/v1/txt2img>)