23 lines
660 B
JavaScript
23 lines
660 B
JavaScript
"use strict";
|
|
|
|
import fs from 'fs';
|
|
|
|
import FilmPredictor from '../../lib/FilmPredictor.mjs';
|
|
|
|
export default async function(settings) {
|
|
if(!fs.existsSync(settings.input)) {
|
|
console.error(`Error: The input file '${settings.input}' doesn't exist (did you type it correctly?)`);
|
|
process.exit(1);
|
|
}
|
|
if(!fs.existsSync(settings.ai_model)) {
|
|
console.error(`Error: Failed to locate AI model directory at '${settings.ai_model}'.`);
|
|
process.exit(1);
|
|
}
|
|
|
|
let model = new FilmPredictor(settings);
|
|
await model.init(settings.ai_model); // We're training a new model here
|
|
|
|
let result = await model.predict(settings.input);
|
|
console.log(result.join("\n"));
|
|
}
|