Skip to content

Instantly share code, notes, and snippets.

@selynna
Last active May 24, 2019 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selynna/f90a86a4d7b787a80d08367dc59d755f to your computer and use it in GitHub Desktop.
Save selynna/f90a86a4d7b787a80d08367dc59d755f to your computer and use it in GitHub Desktop.
console.log("Adding images...");
let fileUploadPromises = [];
const pizzaDir = `${dataRoot}/pizza`;
const pizzaFiles = fs.readdirSync(pizzaDir);
pizzaFiles.forEach(file => {
fileUploadPromises.push(trainer.createImagesFromData(project.id, fs.readFileSync(`${pizzaDir}/${file}`), { tagIds: [pizzaTag.id] }));
});
await Promise.all(fileUploadPromises);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment