"git@developer.sourcefind.cn:chenpangpang/parler-tts.git" did not exist on "62d6bf69c8ec2dbbcab4e2163bc1a9a24d676321"
Commit 266db206 authored by comfyanonymous's avatar comfyanonymous
Browse files

Update colab notebook to use an iframe for GUI.

parent 9fa18279
...@@ -63,7 +63,7 @@ ...@@ -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 @@ ...@@ -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": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment