Vanwise commited on
Commit
2a6463f
·
1 Parent(s): 22d761a

Upload 2 files

Browse files
Files changed (1) hide show
  1. easydiffusion/_main.ipynb +11 -23
easydiffusion/_main.ipynb CHANGED
@@ -18,17 +18,10 @@
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",
20
  " print(f\"Easy Diffusion's git repository was already installed. Updating from {update_branch}..\")\n",
21
- " os.chdir(\"sd-ui-files\")\n",
22
- " subprocess.run(\"git add -A .\", shell=True, capture_output=True, text=True)\n",
23
- " subprocess.run(\"git stash\", shell=True, capture_output=True, text=True)\n",
24
- " subprocess.run(\"git reset --hard\", shell=True, capture_output=True, text=True)\n",
25
- " subprocess.run(f\"git -c advice.detachedHead=false checkout {update_branch}\", shell=True, capture_output=True, text=True)\n",
26
- " subprocess.run(\"git pull\", shell=True, capture_output=True, text=True)\n",
27
- " os.chdir(\"..\")\n",
28
  "else:\n",
29
  " print(\"\\nDownloading Easy Diffusion..\\n\")\n",
30
  " print(f\"Using the {update_branch} channel\\n\")\n",
31
- " if subprocess.run(f\"git clone -b {update_branch} https://github.com/easydiffusion/easydiffusion.git sd-ui-files\", shell=True, capture_output=True, text=True).returncode == 0:\n",
32
  " with open(f\"{current_dir}/sd-ui-files/scripts/install_status.txt\", \"a\") as status_file:\n",
33
  " status_file.write(\"sd_ui_git_cloned\\n\")\n",
34
  " else:\n",
@@ -57,24 +50,19 @@
57
  "\n",
58
  "fix_script()\n",
59
  "\n",
60
- "def gen_key(path: Union[str, Path]) -> None:\n",
61
- " path = Path(path)\n",
62
- " arg_string = f'ssh-keygen -t rsa -b 4096 -N \"\" -q -f {path.as_posix()}'\n",
63
- " args = shlex.split(arg_string)\n",
64
- " subprocess.run(args, check=True)\n",
65
- " path.chmod(0o600)\n",
66
  "\n",
67
  "use_remote = True\n",
68
  "if use_remote:\n",
69
- " id_rsa_file = f\"{current_dir}/id_rsa\"\n",
70
- " id_rsa_pub_file = f\"{current_dir}/id_rsa.pub\"\n",
71
- " if os.path.exists(id_rsa_file):\n",
72
- " os.remove(id_rsa_file)\n",
73
- " if os.path.exists(id_rsa_pub_file):\n",
74
- " os.remove(id_rsa_pub_file)\n",
75
- " ssh_name = \"id_rsa\"\n",
76
- " ssh_path = Path(os.path.dirname(os.getcwd())) / ssh_name\n",
77
- " gen_key(ssh_path)\n",
78
  "\n",
79
  "os.chdir(\"sd-ui-files\")\n",
80
  "\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",
20
  " print(f\"Easy Diffusion's git repository was already installed. Updating from {update_branch}..\")\n",
 
 
 
 
 
 
 
21
  "else:\n",
22
  " print(\"\\nDownloading Easy Diffusion..\\n\")\n",
23
  " print(f\"Using the {update_branch} channel\\n\")\n",
24
+ " if subprocess.run(f\"git clone -b {update_branch} https://github.com/Van-wise/easydiffusion sd-ui-files\", shell=True, capture_output=True, text=True).returncode == 0:\n",
25
  " with open(f\"{current_dir}/sd-ui-files/scripts/install_status.txt\", \"a\") as status_file:\n",
26
  " status_file.write(\"sd_ui_git_cloned\\n\")\n",
27
  " else:\n",
 
50
  "\n",
51
  "fix_script()\n",
52
  "\n",
53
+ "def gen_key(path):\n",
54
+ " arg_string = f'ssh-keygen -t rsa -b 4096 -N \"\" -q -f {path}'\n",
55
+ " subprocess.run(arg_string, shell=True, check=True)\n",
56
+ " os.chmod(path, 0o600)\n",
 
 
57
  "\n",
58
  "use_remote = True\n",
59
  "if use_remote:\n",
60
+ " id_rsa_file = \"/content/id_rsa\"\n",
61
+ " id_rsa_pub_file = \"/content/id_rsa.pub\"\n",
62
+ " for file in (id_rsa_file, id_rsa_pub_file):\n",
63
+ " if os.path.exists(file):\n",
64
+ " os.remove(file)\n",
65
+ " gen_key(id_rsa_file)\n",
 
 
 
66
  "\n",
67
  "os.chdir(\"sd-ui-files\")\n",
68
  "\n",