-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathpinokio.js
148 lines (148 loc) · 5.65 KB
/
pinokio.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
const os = require('os')
const fs = require('fs')
const path = require("path")
const exists = (filepath) => {
return new Promise(r=>fs.access(filepath, fs.constants.F_OK, e => r(!e)))
}
module.exports = {
title: "FaceFusion",
description: "Next generation face swapper and enhancer",
icon: "icon.png",
menu: async (kernel) => {
let installed = await exists(path.resolve(__dirname, "facefusion", "env"))
let conda_installed = await exists(path.resolve(__dirname, "facefusion", "conda_env"))
if (installed) {
let session = (await kernel.loader.load(path.resolve(__dirname, "session.json"))).resolved
return [{
when: "start.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Normal Mode",
type: "label",
href: "start.json"
}, {
when: "start.json",
off: "<i class='fa-solid fa-photo-film'></i> Launch Normal Mode",
href: "start.json?fullscreen=true&run=true",
}, {
when: "start_enhancer.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Enhancer Mode",
type: "label",
href: "start_enhancer.json"
}, {
when: "start_enhancer.json",
off: "<i class='fa-solid fa-photo-film'></i> Launch Enhancer Mode",
href: "start_enhancer.json?fullscreen=true&run=true",
}, {
when: "start.json",
on: (session && session.url ? "<i class='fa-solid fa-rocket'></i> Open Web UI" : null),
href: (session && session.url ? session.url : null),
target: "_blank"
}, {
when: "start.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "start.json?fullscreen=true"
}, {
when: "webcam.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Webcam Mode",
type: "label",
href: "webcam.json"
}, {
when: "webcam.json",
off: "<i class='fa-solid fa-video'></i> Launch Webcam Mode",
href: "webcam.json?fullscreen=true&run=true",
}, {
when: "webcam.json",
on: (session && session.url ? "<i class='fa-solid fa-rocket'></i> Open Web UI" : null),
href: (session && session.url ? session.url : null),
target: "_blank"
}, {
when: "webcam.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "webcam.json?fullscreen=true"
}]
} else if (conda_installed) {
let session = (await kernel.loader.load(path.resolve(__dirname, "session.json"))).resolved
return [{
when: "start_conda.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Normal Mode",
type: "label",
href: "start_conda.json"
}, {
when: "start_conda.json",
off: "<i class='fa-solid fa-photo-film'></i> Launch Normal Mode",
href: "start_conda.json?fullscreen=true&run=true",
}, {
when: "start_enhancer_conda.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Enhancer Mode",
type: "label",
href: "start_enhancer_conda.json"
}, {
when: "start_enhancer_conda.json",
off: "<i class='fa-solid fa-photo-film'></i> Launch Enhancer Mode",
href: "start_enhancer_conda.json?fullscreen=true&run=true",
}, {
when: "start_conda.json",
on: (session && session.url ? "<i class='fa-solid fa-rocket'></i> Open Web UI" : null),
href: (session && session.url ? session.url : null),
target: "_blank"
}, {
when: "start_conda.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "start_conda.json?fullscreen=true"
}, {
when: "webcam_conda.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running Webcam Mode",
type: "label",
href: "webcam_conda.json"
}, {
when: "webcam_conda.json",
off: "<i class='fa-solid fa-video'></i> Launch Webcam Mode",
href: "webcam_conda.json?fullscreen=true&run=true",
}, {
when: "webcam_conda.json",
on: (session && session.url ? "<i class='fa-solid fa-rocket'></i> Open Web UI" : null),
href: (session && session.url ? session.url : null),
target: "_blank"
}, {
when: "webcam_conda.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "webcam_conda.json?fullscreen=true"
}]
} else {
let arch = os.arch()
let platform = os.platform()
if (platform === 'darwin') {
if (arch === "x64") {
return [{
html: '<i class="fa-solid fa-plug"></i> Install for Intel Mac',
type: "link",
href: "install_apple_intel.json?run=true&fullscreen=true"
}]
} else if (arch === "arm64") {
return [{
html: '<i class="fa-solid fa-plug"></i> Install for M1/M2 Mac',
type: "link",
href: "install_apple_silicon.json?run=true&fullscreen=true"
}]
}
} else {
return [{
html: '<i class="fa-solid fa-plug"></i> Install for CPU',
type: "link",
href: "install_cpu.json?run=true&fullscreen=true"
}, {
html: '<i class="fa-solid fa-plug"></i> Install for CUDA',
type: "link",
href: "install_cuda.json?run=true&fullscreen=true"
}, {
html: '<i class="fa-solid fa-plug"></i> Install for DirectML',
type: "link",
href: "install_directml.json?run=true&fullscreen=true"
}, {
html: '<i class="fa-solid fa-plug"></i> Install for Openvino',
type: "link",
href: "install_openvino.json?run=true&fullscreen=true"
}]
}
}
}
}