Upload 2 files
Browse files- easydiffusion/_main.ipynb +3 -1
- easydiffusion/_start.ipynb +12 -3
easydiffusion/_main.ipynb
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
"from pathlib import Path\n",
|
| 14 |
"from typing import Union\n",
|
| 15 |
"print(\"\\nEasy Diffusion - v3\\n\")\n",
|
| 16 |
-
"current_dir = os.getcwd()\n",
|
| 17 |
"update_branch = os.path.isfile(f\"{current_dir}/sd-ui-files/scripts/get_config.py\") and subprocess.run(f\"python {current_dir}/sd-ui-files/scripts/get_config.py --default=main update_branch\", shell=True, capture_output=True, text=True).stdout.strip() or \"main\"\n",
|
| 18 |
"\n",
|
| 19 |
"if os.path.isfile(f\"{current_dir}/install_status.txt\") and \"sd_ui_git_cloned\" in open(f\"{current_dir}/install_status.txt\").read():\n",
|
|
@@ -77,6 +77,8 @@
|
|
| 77 |
" gen_key(ssh_path)\n",
|
| 78 |
"\n",
|
| 79 |
"os.chdir(\"sd-ui-files\")\n",
|
|
|
|
|
|
|
| 80 |
"!python ./scripts/check_modules.py #安装依赖&环境\n",
|
| 81 |
"!pip install --upgrade pytorch-lightning\n",
|
| 82 |
"!apt-get install aria2\n",
|
|
|
|
| 13 |
"from pathlib import Path\n",
|
| 14 |
"from typing import Union\n",
|
| 15 |
"print(\"\\nEasy Diffusion - v3\\n\")\n",
|
| 16 |
+
"current_dir = os.environ['CURRENT_DIR'] = os.getcwd() if 'current_dir' not in os.environ else os.environ['CURRENT_DIR']\n",
|
| 17 |
"update_branch = os.path.isfile(f\"{current_dir}/sd-ui-files/scripts/get_config.py\") and subprocess.run(f\"python {current_dir}/sd-ui-files/scripts/get_config.py --default=main update_branch\", shell=True, capture_output=True, text=True).stdout.strip() or \"main\"\n",
|
| 18 |
"\n",
|
| 19 |
"if os.path.isfile(f\"{current_dir}/install_status.txt\") and \"sd_ui_git_cloned\" in open(f\"{current_dir}/install_status.txt\").read():\n",
|
|
|
|
| 77 |
" gen_key(ssh_path)\n",
|
| 78 |
"\n",
|
| 79 |
"os.chdir(\"sd-ui-files\")\n",
|
| 80 |
+
"main_dir = os.environ['MAIN_DIR'] = os.getcwd() if 'MAIN_DIR' not in os.environ else os.environ['MAIN_DIR']\n",
|
| 81 |
+
"\n",
|
| 82 |
"!python ./scripts/check_modules.py #安装依赖&环境\n",
|
| 83 |
"!pip install --upgrade pytorch-lightning\n",
|
| 84 |
"!apt-get install aria2\n",
|
easydiffusion/_start.ipynb
CHANGED
|
@@ -11,9 +11,18 @@
|
|
| 11 |
"import time\n",
|
| 12 |
"import os\n",
|
| 13 |
"#/content/esay\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
"\n",
|
| 15 |
"def start_tunnle():\n",
|
| 16 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
" if ngrok_token:\n",
|
| 18 |
" try:\n",
|
| 19 |
" from pyngrok import ngrok\n",
|
|
@@ -25,7 +34,7 @@
|
|
| 25 |
" if use_cloudflare:\n",
|
| 26 |
" try:\n",
|
| 27 |
" from pycloudflared import try_cloudflare\n",
|
| 28 |
-
" cloudflare_url = try_cloudflare(
|
| 29 |
" print(\"cloudflare_tunnel:\", cloudflare_url)\n",
|
| 30 |
" except Exception as e:\n",
|
| 31 |
" print(\"cloudflare 连接失败:\", e)\n",
|
|
@@ -38,7 +47,7 @@
|
|
| 38 |
"\n",
|
| 39 |
"threading.Thread(target=start_tunnle, daemon=True).start()\n",
|
| 40 |
"\n",
|
| 41 |
-
"!python {current_dir}/sd-ui-files/scripts/check_modules.py --launch-uvicorn\n",
|
| 42 |
"#!python ./ui/main.py"
|
| 43 |
]
|
| 44 |
}
|
|
|
|
| 11 |
"import time\n",
|
| 12 |
"import os\n",
|
| 13 |
"#/content/esay\n",
|
| 14 |
+
"current_dir = os.environ['CURRENT_DIR']\n",
|
| 15 |
+
"main_dir = os.environ['MAIN_DIR']\n",
|
| 16 |
+
"%cd {main_dir}\n",
|
| 17 |
+
"use_remote = True # @param {type:\"boolean\"}\n",
|
| 18 |
+
"use_cloudflare = True # @param {type:\"boolean\"}\n",
|
| 19 |
"\n",
|
| 20 |
"def start_tunnle():\n",
|
| 21 |
+
" open(\"/content/output.log\", \"w\").close()\n",
|
| 22 |
+
" # 循环检测文件内容,直到存在\"http://127.0.0.1:9090\"。\n",
|
| 23 |
+
" while not \"Warning: Could not find TensorRT\" in open(\"/content/output.log\", \"r\").read():\n",
|
| 24 |
+
" time.sleep(1)\n",
|
| 25 |
+
" clear_output() \n",
|
| 26 |
" if ngrok_token:\n",
|
| 27 |
" try:\n",
|
| 28 |
" from pyngrok import ngrok\n",
|
|
|
|
| 34 |
" if use_cloudflare:\n",
|
| 35 |
" try:\n",
|
| 36 |
" from pycloudflared import try_cloudflare\n",
|
| 37 |
+
" cloudflare_url = try_cloudflare(9000, verbose=False)\n",
|
| 38 |
" print(\"cloudflare_tunnel:\", cloudflare_url)\n",
|
| 39 |
" except Exception as e:\n",
|
| 40 |
" print(\"cloudflare 连接失败:\", e)\n",
|
|
|
|
| 47 |
"\n",
|
| 48 |
"threading.Thread(target=start_tunnle, daemon=True).start()\n",
|
| 49 |
"\n",
|
| 50 |
+
"!python {current_dir}/sd-ui-files/scripts/check_modules.py --launch-uvicorn 2>&1 | tee /content/output.log\n",
|
| 51 |
"#!python ./ui/main.py"
|
| 52 |
]
|
| 53 |
}
|