alwaysai
Version:
The alwaysAI command-line interface (CLI)
54 lines • 1.99 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockModel = void 0;
const tempy = require("tempy");
const model_package_cloud_client_1 = require("./model-package-cloud-client");
const model_package_json_file_1 = require("./model-package-json-file");
const model_id_1 = require("./model-id");
const util_1 = require("../../util");
const infrastructure_1 = require("../../infrastructure");
async function MockModel() {
const { username } = await (0, infrastructure_1.CliAuthenticationClient)().getInfo();
const id = model_id_1.ModelId.serialize({
publisher: username,
name: (0, util_1.RandomString)()
});
const dir = tempy.directory();
const modelJsonFile = (0, model_package_json_file_1.ModelPackageJsonFile)(dir);
const json = {
accuracy: '',
dataset: '',
description: (0, util_1.RandomString)(),
id,
inference_time: null,
license: '',
mean_average_precision_top_1: null,
mean_average_precision_top_5: null,
public: false,
website_url: '',
model_parameters: {
framework_type: 'caffe',
config_file: 'models/MobileNetSSD_deploy.prototxt.txt',
size: [300, 300],
model_file: 'models/MobileNetSSD_deploy.caffemodel',
label_file: 'labels/pascal_voc.txt',
scalefactor: 0.007843,
mean: [127.5, 127.5, 127.5],
crop: true,
swaprb: false,
purpose: 'ObjectDetection'
}
};
modelJsonFile.write(json);
const spy = jest.spyOn(process, 'cwd');
spy.mockReturnValue(dir);
const uuid = await model_package_cloud_client_1.modelPackageCloudClient.publish(undefined);
const metadata = await (0, infrastructure_1.CliRpcClient)().getModelVersionByUuid(uuid);
return {
json,
dir,
metadata
};
}
exports.MockModel = MockModel;
//# sourceMappingURL=mock-model.js.map