-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathinstall.js
126 lines (125 loc) · 3.93 KB
/
install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
const path = require("path")
const os = require('os')
module.exports = async (kernel) => {
const platform = os.platform()
const graphics = await kernel.system.graphics()
const vendors = graphics.controllers.map((c) => { return c.vendor.toLowerCase() })
// const vendor = graphics.controllers[0].vendor
let setup
if (platform === "darwin") {
setup = [{
method: "shell.run",
params: { message: "brew install cmake protobuf rust python@3.10 git wget", },
//params: { message: "brew install protobuf rust wget", },
}, {
method: "shell.run",
params: { message: "git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui automatic1111", path: path.resolve(__dirname) },
}]
} else {
let test = vendors.filter((vendor) => {
return /advanced micro devices/i.test(vendor)
}).length > 0
if (test) {
if (platform === 'win32') {
setup = [{
method: "shell.run",
params: { message: "git clone https://github.com/lshqqytiger/stable-diffusion-webui-directml.git automatic1111", path: __dirname }
}]
} else {
setup = [{
method: "shell.run",
params: { message: "git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui automatic1111", path: __dirname },
}]
}
} else {
setup = [{
method: "shell.run",
params: { message: "git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui automatic1111", path: __dirname },
}]
}
}
let run = setup.concat([{
"uri": "./index.js",
"method": "config",
}, {
"method": "self.set",
"params": {
"automatic1111/ui-config.json": {
"txt2img/Width/value": 1024,
"txt2img/Height/value": 1024,
}
}
}, {
"method": "notify",
"params": {
"html": "<b>Downloading Model</b><br>Downloading the Stable Diffusion XL 1.0 model..."
}
}, {
"method": "fs.download",
"params": {
"url": "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors",
"path": "automatic1111/models/Stable-diffusion/sd_xl_base_1.0.safetensors"
}
}, {
"method": "fs.download",
"params": {
"url": "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors",
"path": "automatic1111/models/Stable-diffusion/sd_xl_refiner_1.0.safetensors"
}
// }, {
// "method": "fs.download",
// "params": {
// //"url": "https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors",
// //"path": "automatic1111/models/Stable-diffusion/sd_xl_base_0.9.vae.safetensors"
// "url": "https://huggingface.co/stabilityai/sdxl-vae/blob/main/sdxl_vae.safetensors",
// "path": "automatic1111/models/Stable-diffusion/sd_xl_base_1.0.vae.safetensors"
// }
}, {
"method": "notify",
"params": {
"html": "<b>Installing webui</b><br>All SDXL 1.0 models downloaded successfully. Now setting up Automatic1111/stable-diffusion-webui..."
}
}, {
"method": "shell.start",
"params": {
"path": "automatic1111",
"env": {
"SD_WEBUI_RESTARTING": 1,
"HF_HOME": "../huggingface"
},
}
}, {
"method": "shell.enter",
"params": {
"message": "{{os.platform() === 'win32' ? 'webui-user.bat' : 'bash webui.sh -f'}}",
"on": [{
"event": "/(http:\/\/[0-9.:]+)/",
"return": "{{event.matches[0][1]}}"
}]
}
}, {
"method": "local.set",
"params": {
"url": "{{input}}"
}
}, {
"method": "input",
"params": {
"title": "Install Success",
"description": "Go back to the dashboard and launch the app!"
}
}, {
"method": "browser.open",
"params": {
"uri": "/?selected=Stable Diffusion web UI"
}
}])
let o = { run }
if (platform === 'darwin') {
o.requires = [{
platform: "darwin",
name: "brew"
}]
}
return o
}