Commit c0fb0c84 authored by comfyanonymous's avatar comfyanonymous
Browse files

Update colab notebook.

parent dfb397e0
......@@ -383,8 +383,8 @@ class PromptQueue:
with self.mutex:
self.history.pop(id_to_delete, None)
async def run(server, address='', port=8188):
await asyncio.gather(server.start(address, port), server.publish_loop())
async def run(server, address='', port=8188, verbose=True):
await asyncio.gather(server.start(address, port, verbose), server.publish_loop())
def hijack_progress(server):
from tqdm.auto import tqdm
......@@ -410,6 +410,10 @@ if __name__ == "__main__":
else:
address = '127.0.0.1'
dont_print = False
if '--dont-print-server' in sys.argv:
dont_print = True
port = 8188
try:
p_index = sys.argv.index('--port')
......@@ -419,9 +423,9 @@ if __name__ == "__main__":
if os.name == "nt":
try:
loop.run_until_complete(run(server, address=address, port=port))
loop.run_until_complete(run(server, address=address, port=port, verbose=not dont_print))
except KeyboardInterrupt:
pass
else:
loop.run_until_complete(run(server, address=address, port=port))
loop.run_until_complete(run(server, address=address, port=port, verbose=not dont_print))
......@@ -36,7 +36,8 @@
"!git clone https://github.com/comfyanonymous/ComfyUI\n",
"%cd ComfyUI\n",
"!pip install -r requirements.txt\n",
"!pip install xformers"
"!pip install xformers\n",
"!sed -i 's/v1-inference.yaml/v1-inference_fp16.yaml/g' webshit/index.html"
]
},
{
......@@ -86,20 +87,23 @@
{
"cell_type": "markdown",
"source": [
"### Run ComfyUI \n",
"use the **fp16** model configs for more speed\n",
"### Run ComfyUI with localtunnel\n",
"\n",
"You should see the ui appear in an iframe. If you get a 403 error, it's your firefox settings or an extension that's messing things up.\n",
"If you have issues with the previous way, you can try this way. It will also work on non colab.\n",
"\n",
"If you want to open it in another window use the second link not the first one.\n"
"use the **fp16** model configs for more speed\n",
"\n"
],
"metadata": {
"id": "gggggggggg"
"id": "kkkkkkkkkkkkkk"
}
},
{
"cell_type": "code",
"source": [
"!npm install -g localtunnel\n",
"\n",
"import subprocess\n",
"import threading\n",
"import time\n",
"import socket\n",
......@@ -111,17 +115,17 @@
" if result == 0:\n",
" break\n",
" sock.close()\n",
" from google.colab import output\n",
" output.serve_kernel_port_as_iframe(port, height=1024)\n",
" print(\"to open it in a window you can open this link here:\")\n",
" output.serve_kernel_port_as_window(port)\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"
"!python main.py --highvram --dont-print-server"
],
"metadata": {
"id": "hhhhhhhhhh"
"id": "jjjjjjjjjjjjj"
},
"execution_count": null,
"outputs": []
......@@ -129,23 +133,20 @@
{
"cell_type": "markdown",
"source": [
"### Run ComfyUI with localtunnel\n",
"### Run ComfyUI with colab iframe (in case localtunnel doesn't work)\n",
"use the **fp16** model configs for more speed\n",
"\n",
"If you have issues with the previous way, you can try this way. It will also work on non colab.\n",
"You should see the ui appear in an iframe. If you get a 403 error, it's your firefox settings or an extension that's messing things up.\n",
"\n",
"use the **fp16** model configs for more speed\n",
"\n"
"If you want to open it in another window use the link.\n"
],
"metadata": {
"id": "kkkkkkkkkkkkkk"
"id": "gggggggggg"
}
},
{
"cell_type": "code",
"source": [
"!npm install -g localtunnel\n",
"\n",
"import subprocess\n",
"import threading\n",
"import time\n",
"import socket\n",
......@@ -157,17 +158,17 @@
" 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",
" from google.colab import output\n",
" output.serve_kernel_port_as_iframe(port, height=1024)\n",
" print(\"to open it in a window you can open this link here:\")\n",
" output.serve_kernel_port_as_window(port)\n",
"\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
"\n",
"!python main.py --highvram"
"!python main.py --highvram --dont-print-server"
],
"metadata": {
"id": "jjjjjjjjjjjjj"
"id": "hhhhhhhhhh"
},
"execution_count": null,
"outputs": []
......
......@@ -190,7 +190,7 @@ class PromptServer():
msg = await self.messages.get()
await self.send(*msg)
async def start(self, address, port):
async def start(self, address, port, verbose=True):
runner = web.AppRunner(self.app)
await runner.setup()
site = web.TCPSite(runner, address, port)
......@@ -198,5 +198,6 @@ class PromptServer():
if address == '':
address = '0.0.0.0'
print("Starting server\n")
print("To see the GUI go to: http://{}:{}".format(address, port))
if verbose:
print("Starting server\n")
print("To see the GUI go to: http://{}:{}".format(address, port))
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