Skip to content

Commit

Permalink
Add some cells to run with localtunnel in colab notebook.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Feb 23, 2023
1 parent 62df8dd commit 5796705
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions notebooks/comfyui_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,52 @@
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"### Run ComfyUI with localtunnel\n",
"\n",
"If you have issues with the previous way, you can try this way. It will also work on non colab.\n",
"\n",
"use the **fp16** model configs for more speed\n",
"\n"
],
"metadata": {
"id": "kkkkkkkkkkkkkk"
}
},
{
"cell_type": "code",
"source": [
"!npm install -g localtunnel\n",
"\n",
"import subprocess\n",
"import threading\n",
"import time\n",
"import socket\n",
"def iframe_thread(port):\n",
" while True:\n",
" time.sleep(0.5)\n",
" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
" result = sock.connect_ex(('127.0.0.1', port))\n",
" if result == 0:\n",
" break\n",
" sock.close()\n",
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
" for line in p.stdout:\n",
" print(line.decode(), end='')\n",
"\n",
"\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
"\n",
"!python main.py --highvram"
],
"metadata": {
"id": "jjjjjjjjjjjjj"
},
"execution_count": null,
"outputs": []
}
]
}

0 comments on commit 5796705

Please sign in to comment.