From 5c6ae0be5be445a7c6a7b9c3f5ab64be52fe8b60 Mon Sep 17 00:00:00 2001 From: TheUnfocused <33618431+umutpo@users.noreply.github.com> Date: Sun, 4 Aug 2024 11:11:28 -0700 Subject: [PATCH] Finalized for testing today --- colab_runner.ipynb | 48 --------------------------------------------- run_colab_mac.sh | 4 +++- run_colab_ubuntu.sh | 9 ++++++++- run_colab_win.bat | 4 +++- run_local_mac.sh | 5 ++++- run_local_ubuntu.sh | 5 ++++- 6 files changed, 22 insertions(+), 53 deletions(-) diff --git a/colab_runner.ipynb b/colab_runner.ipynb index edc1a9509..700752f22 100644 --- a/colab_runner.ipynb +++ b/colab_runner.ipynb @@ -211,54 +211,6 @@ "\n", "!python main.py --dont-print-server" ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "kkkkkkkkkkkkkk" - }, - "source": [ - "### Run ComfyUI with localtunnel\n", - "\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "jjjjjjjjjjjjj" - }, - "outputs": [], - "source": [ - "!npm install -g localtunnel\n", - "\n", - "import subprocess\n", - "import threading\n", - "import time\n", - "import socket\n", - "import urllib.request\n", - "\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", - " print(\"\\nComfyUI finished loading, trying to launch localtunnel (if it gets stuck here localtunnel is having issues)\\n\")\n", - "\n", - " print(\"The password/enpoint ip for localtunnel is:\", urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\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 --dont-print-server" - ] } ], "metadata": { diff --git a/run_colab_mac.sh b/run_colab_mac.sh index 33364663e..2e7292f10 100755 --- a/run_colab_mac.sh +++ b/run_colab_mac.sh @@ -2,7 +2,9 @@ echo "Make sure you set up your branch name in colab_runner.ipynb" -python3 -m venv .venv +if ! [ -d "./.venv" ]; then + python3 -m venv .venv +fi source .venv/bin/activate python3 -m pip install pydrive sudo python3 connect_to_colab.py diff --git a/run_colab_ubuntu.sh b/run_colab_ubuntu.sh index ded86964c..e0428b08f 100755 --- a/run_colab_ubuntu.sh +++ b/run_colab_ubuntu.sh @@ -1,4 +1,11 @@ #!/bin/bash echo "Make sure you set up your branch name in colab_runner.ipynb" -python3 -m venv .venv && source .venv/bin/activate && python3 -m pip install pydrive && sudo python3 connect_to_colab.py && deactivate \ No newline at end of file + +if ! [ -d "./.venv" ]; then + python3 -m venv .venv +fi +source .venv/bin/activate +python3 -m pip install pydrive +sudo python3 connect_to_colab.py +deactivate \ No newline at end of file diff --git a/run_colab_win.bat b/run_colab_win.bat index bc6677632..1a56ffbad 100644 --- a/run_colab_win.bat +++ b/run_colab_win.bat @@ -1,6 +1,8 @@ echo Make sure you set up your branch name in colab_runner.ipynb -python -m venv .venv +IF NOT EXIST ".venv" ( + python -m venv .venv +) call .venv\Scripts\activate.bat python -m pip install pydrive python connect_to_colab.py diff --git a/run_local_mac.sh b/run_local_mac.sh index 01416d129..37f74d77d 100644 --- a/run_local_mac.sh +++ b/run_local_mac.sh @@ -4,4 +4,7 @@ echo "Make sure you set up your branch name in colab_runner.ipynb" if ! [ -d "./.venv" ]; then python3 -m venv .venv fi -source .venv/bin/activate && python3 -m pip install -r requirements.txt && python3 main.py --dont-print-server && deactivate \ No newline at end of file +source .venv/bin/activate +python3 -m pip install -r requirements.txt +python3 main.py --dont-print-server +deactivate \ No newline at end of file diff --git a/run_local_ubuntu.sh b/run_local_ubuntu.sh index ceca5b350..facba26e2 100755 --- a/run_local_ubuntu.sh +++ b/run_local_ubuntu.sh @@ -5,4 +5,7 @@ echo "Make sure you set up your branch name in colab_runner.ipynb" if ! [ -d "./.venv"]; then python3 -m venv .venv fi -source .venv/bin/activate && python3 -m pip install -r requirements.txt && python3 main.py --dont-print-server && deactivate \ No newline at end of file +source .venv/bin/activate +python3 -m pip install -r requirements.txt +python3 main.py --dont-print-server +deactivate \ No newline at end of file