tt
This commit is contained in:
parent
f4660baeb8
commit
d308d334f8
4 changed files with 9 additions and 7 deletions
|
@ -146,7 +146,7 @@ const registerPrivilegedSchemes = () => {
|
|||
*
|
||||
* This window will show the HTML served from {@link rendererURL}.
|
||||
*/
|
||||
const createMainWindow = async () => {
|
||||
const createMainWindow = () => {
|
||||
// Create the main window. This'll show our web content.
|
||||
const window = new BrowserWindow({
|
||||
webPreferences: {
|
||||
|
@ -160,7 +160,7 @@ const createMainWindow = async () => {
|
|||
show: false,
|
||||
});
|
||||
|
||||
const wasAutoLaunched = await autoLauncher.wasAutoLaunched();
|
||||
const wasAutoLaunched = autoLauncher.wasAutoLaunched();
|
||||
if (wasAutoLaunched) {
|
||||
// Don't automatically show the app's window if we were auto-launched.
|
||||
// On macOS, also hide the dock icon on macOS.
|
||||
|
@ -367,7 +367,7 @@ const main = () => {
|
|||
// Note that some Electron APIs can only be used after this event occurs.
|
||||
app.on("ready", async () => {
|
||||
// Create window and prepare for the renderer.
|
||||
mainWindow = await createMainWindow();
|
||||
mainWindow = createMainWindow();
|
||||
attachIPCHandlers();
|
||||
attachFSWatchIPCHandlers(createWatcher(mainWindow));
|
||||
registerStreamProtocol();
|
||||
|
|
|
@ -38,7 +38,7 @@ class AutoLauncher {
|
|||
}
|
||||
}
|
||||
|
||||
async wasAutoLaunched() {
|
||||
wasAutoLaunched() {
|
||||
if (this.autoLaunch) {
|
||||
return app.commandLine.hasSwitch("hidden");
|
||||
} else {
|
||||
|
|
|
@ -49,7 +49,7 @@ const clipImageEmbedding_ = async (jpegFilePath: string) => {
|
|||
return normalizeEmbedding(imageEmbedding);
|
||||
};
|
||||
|
||||
const getRGBData = async (jpegFilePath: string) => {
|
||||
const getRGBData = async (jpegFilePath: string): Promise<number[]> => {
|
||||
const jpegData = await fs.readFile(jpegFilePath);
|
||||
const rawImageData = jpeg.decode(jpegData, {
|
||||
useTArray: true,
|
||||
|
@ -64,7 +64,7 @@ const getRGBData = async (jpegFilePath: string) => {
|
|||
const ny2 = 224;
|
||||
const totalSize = 3 * nx2 * ny2;
|
||||
|
||||
const result: number[] = Array(totalSize).fill(0);
|
||||
const result = Array(totalSize).fill(0);
|
||||
const scale = Math.max(nx, ny) / 224;
|
||||
|
||||
const nx3 = Math.round(nx / scale);
|
||||
|
|
|
@ -47,5 +47,7 @@ export const faceEmbedding = async (input: Float32Array) => {
|
|||
const results = await session.run(feeds);
|
||||
log.debug(() => `onnx/yolo face embedding took ${Date.now() - t} ms`);
|
||||
/* Need these model specific casts to extract and type the result */
|
||||
return (results.embeddings as unknown as any)["cpuData"] as Float32Array;
|
||||
return (results.embeddings as unknown as Record<string, unknown>)[
|
||||
"cpuData"
|
||||
] as Float32Array;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue