Skip to content

armgit / ente

Public Imported from GitHub
0

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

update computeImageEmbeddings to accept imageData

Abhinav8640972c6409
diff --git a/src/api/clip.ts b/src/api/clip.ts
index 355648adda..31692a7fe5 100644
--- a/src/api/clip.ts
+++ b/src/api/clip.ts
@@ -2,15 +2,13 @@ import { ipcRenderer } from 'electron';
import { writeStream } from '../services/fs';
export async function computeImageEmbeddings(
- imageFile: File
+ imageData: Uint8Array
): Promise<Float32Array> {
let tempInputFilePath = null;
try {
- tempInputFilePath = await ipcRenderer.invoke(
- 'get-temp-file-path',
- imageFile.name
- );
- await writeStream(tempInputFilePath, imageFile.stream());
+ tempInputFilePath = await ipcRenderer.invoke('get-temp-file-path', '');
+ const imageStream = new Response(imageData.buffer).body;
+ await writeStream(tempInputFilePath, imageStream);
const embeddings = await ipcRenderer.invoke(
'compute-image-embeddings',
tempInputFilePath