mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-11 02:15:17 +00:00
Update colab notebook to use an iframe for GUI.
This commit is contained in:
parent
9fa1827906
commit
266db2066d
@ -63,7 +63,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"source": [
|
"source": [
|
||||||
"Launch a http server to see the output pics:"
|
"Optional: Launch a http server to see the output pics (you can also download them by browsing to the output directory with colab):"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"id": "eeeeeeeeee"
|
"id": "eeeeeeeeee"
|
||||||
@ -94,10 +94,22 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"source": [
|
"source": [
|
||||||
"from google.colab import output\n",
|
"import threading\n",
|
||||||
"print(\"open this next link instead once the software prints: To see the GUI go to\")\n",
|
"import time\n",
|
||||||
"output.serve_kernel_port_as_window(8188)\n",
|
"import socket\n",
|
||||||
"!sed -i 's/127.0.0.1/0.0.0.0/g' main.py\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",
|
||||||
|
" from google.colab import output\n",
|
||||||
|
" x = output.serve_kernel_port_as_window(port)\n",
|
||||||
|
" x = output.serve_kernel_port_as_iframe(port, height=1024)\n",
|
||||||
|
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
|
||||||
|
"\n",
|
||||||
"!python main.py"
|
"!python main.py"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
Loading…
Reference in New Issue
Block a user