Wire together
This commit is contained in:
parent
a88f551b6a
commit
41f7b30ca0
3 changed files with 29 additions and 2 deletions
|
@ -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());
|
||||
|
|
|
@ -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("");
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue