Import onnxruntime with TypeScript types
Refs: - https://github.com/microsoft/onnxruntime/issues/17979
This commit is contained in:
@@ -14,13 +14,13 @@ import { existsSync } from "fs";
|
||||
import jpeg from "jpeg-js";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { CustomErrors } from "../../types/ipc";
|
||||
import * as ort from "onnxruntime-node";
|
||||
import Tokenizer from "../../thirdparty/clip-bpe-ts/mod";
|
||||
import { CustomErrors } from "../../types/ipc";
|
||||
import { writeStream } from "../fs";
|
||||
import log from "../log";
|
||||
import { generateTempFilePath } from "../temp";
|
||||
import { deleteTempFile } from "./ffmpeg";
|
||||
const ort = require("onnxruntime-node");
|
||||
|
||||
const textModelName = "clip-text-vit-32-uint8.onnx";
|
||||
const textModelByteSize = 64173509; // 61.2 MB
|
||||
|
||||
9
desktop/src/main/types/onnx-runtime.d.ts
vendored
Normal file
9
desktop/src/main/types/onnx-runtime.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Types for [onnxruntime-node](https://onnxruntime.ai/docs/api/js/index.html).
|
||||
*
|
||||
* Note: these are not the official types but are based on a temporary
|
||||
* [workaround](https://github.com/microsoft/onnxruntime/issues/17979).
|
||||
*/
|
||||
declare module "onnxruntime-node" {
|
||||
export * from "onnxruntime-common";
|
||||
}
|
||||
Reference in New Issue
Block a user