Update colab notebook.
This commit is contained in:
parent
dfb397e034
commit
c0fb0c848f
12
main.py
12
main.py
|
@ -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"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -83,49 +84,6 @@
|
|||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Run ComfyUI \n",
|
||||
"use the **fp16** model configs for more speed\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",
|
||||
"\n",
|
||||
"If you want to open it in another window use the second link not the first one.\n"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "gggggggggg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"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",
|
||||
" 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"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "hhhhhhhhhh"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
|
@ -164,13 +122,56 @@
|
|||
"\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"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Run ComfyUI with colab iframe (in case localtunnel doesn't work)\n",
|
||||
"use the **fp16** model configs for more speed\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",
|
||||
"\n",
|
||||
"If you want to open it in another window use the link.\n"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "gggggggggg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"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",
|
||||
" 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 --dont-print-server"
|
||||
],
|
||||
"metadata": {
|
||||
"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))
|
||||
|
|
Loading…
Reference in New Issue