Files
SwarmUI/colab/colab-notebook.ipynb
2024-08-23 14:31:19 -07:00

91 lines
2.6 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#### PICK ONE: This node for temporary install\n",
"SWARMPATH = '/content/'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#### PICK ONE: *OR* this node for install in google drive\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')\n",
"SWARMPATH = '/content/drive/MyDrive'\n",
"\n",
"# Colab breaks venvs, and doesn't save anything valid to drive, so just screw it do a global install of pip reqs if we used a comfy backend in the drive\n",
"!if [[ -f \"$SWARMPATH/SwarmUI/dlbackend/ComfyUI/requirements.txt\" ]]; then rm -rf $SWARMPATH/SwarmUI/dlbackend/ComfyUI/venv/; pip install -r $SWARMPATH/SwarmUI/dlbackend/ComfyUI/requirements.txt; fi"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Sg0HeYwkM48V"
},
"outputs": [],
"source": [
"# Install dotnet dependencies\n",
"!wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh\n",
"!chmod +x dotnet-install.sh\n",
"!./dotnet-install.sh --channel 8.0\n",
"\n",
"# Install Clouldflared\n",
"!wget https://github.com/cloudflare/cloudflared/releases/download/2024.8.2/cloudflared-linux-amd64.deb\n",
"!dpkg -i cloudflared-linux-amd64.deb\n",
"\n",
"# use the chosen path\n",
"import os\n",
"os.environ['SWARMPATH'] = SWARMPATH\n",
"%cd $SWARMPATH\n",
"\n",
"# Colab breaks venv, so, tell swarm to not make a venv\n",
"os.environ['SWARM_NO_VENV'] = 'true'\n",
"\n",
"# Download SwarmUI\n",
"url = \"https://github.com/mcmonkeyprojects/SwarmUI\"\n",
"!git clone $url"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "K9Oer9TVObYA"
},
"outputs": [],
"source": [
"# Alright, launch it! Watch the output for a Cloudflare URL\n",
"%cd $SWARMPATH/SwarmUI/\n",
"!git pull\n",
"\n",
"!bash ./launch-linux.sh --launch_mode none --cloudflared-path cloudflared"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"gpuType": "T4",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}