Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Wire together

Manav Rathi41f7b30ca078
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts
index 1d863b8e9a..b6e8848183 100644
--- a/desktop/src/main/ipc.ts
+++ b/desktop/src/main/ipc.ts
@@ -36,13 +36,14 @@ import {
updateAndRestart,
updateOnNextRestart,
} from "./services/app-update";
-import { clipImageEmbedding, clipTextEmbedding } from "./services/ml-clip";
import { runFFmpegCmd } from "./services/ffmpeg";
import { getDirFiles } from "./services/fs";
import {
convertToJPEG,
generateImageThumbnail,
} from "./services/imageProcessor";
+import { clipImageEmbedding, clipTextEmbedding } from "./services/ml-clip";
+import { detectFaces, faceEmbedding } from "./services/ml-face";
import {
clearStores,
encryptionKey,
@@ -146,6 +147,14 @@ export const attachIPCHandlers = () => {
clipTextEmbedding(text),
);
+ ipcMain.handle("detectFaces", (_, imageData: Uint8Array) =>
+ detectFaces(imageData),
+ );
+
+ ipcMain.handle("faceEmbedding", (_, input: Float32Array) =>
+ faceEmbedding(input),
+ );
+
// - File selection
ipcMain.handle("selectDirectory", () => selectDirectory());
diff --git a/desktop/src/main/services/ml-face.ts b/desktop/src/main/services/ml-face.ts
index bf8eea1625..066f5406bf 100644
--- a/desktop/src/main/services/ml-face.ts
+++ b/desktop/src/main/services/ml-face.ts
@@ -78,6 +78,16 @@ const faceEmbeddingSession = async () => {
return _faceEmbeddingSession;
};
+export const detectFaces = async (inputImage: Uint8Array) => {
+ throw new Error("test");
+};
+
+export const faceEmbedding = async (input: Float32Array) => {
+ throw new Error("test");
+};
+
+/*
+
private async initOnnx() {
console.log("start ort");
this.onnxInferenceSession = await ort.InferenceSession.create(
@@ -100,7 +110,7 @@ private async getOnnxInferenceSession() {
}
return this.onnxInferenceSession;
}
-
+*/
// export const clipImageEmbedding = async (jpegImageData: Uint8Array) => {
// const tempFilePath = await generateTempFilePath("");
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index 07736502bd..bea5c9e18f 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -143,6 +143,12 @@ const clipImageEmbedding = (jpegImageData: Uint8Array): Promise<Float32Array> =>
const clipTextEmbedding = (text: string): Promise<Float32Array> =>
ipcRenderer.invoke("clipTextEmbedding", text);
+const detectFaces = (imageData: Uint8Array): Promise<Float32Array> =>
+ ipcRenderer.invoke("detectFaces", imageData);
+
+const faceEmbedding = (input: Float32Array): Promise<Float32Array> =>
+ ipcRenderer.invoke("faceEmbedding", input);
+
// - File selection
// TODO: Deprecated - use dialogs on the renderer process itself
@@ -322,6 +328,8 @@ contextBridge.exposeInMainWorld("electron", {
// - ML
clipImageEmbedding,
clipTextEmbedding,
+ detectFaces,
+ faceEmbedding,
// - File selection
selectDirectory,