deepforge-dev / deepforge-keras

A deepforge extension providing support for neural networks using keras
Apache License 2.0
8 stars 3 forks source link

JSON importer support in the browser #201

Closed brollb closed 4 years ago

brollb commented 4 years ago

JSON importer should support creation using the client rather than the core. This would enable it to be used from the browser.

brollb commented 4 years ago

This is actually a non-issue since the core can be used in the browser:

// Get the core, rootNode from the WebGME client
const {core, rootNode} = await new Promise(
    (resolve, reject) => client.getCoreInstance(logger, (err, result) => err ? reject(err) : resolve(result))
);
// Load the node to edit and importer
const nodeToChange = await core.loadByPath(rootNode, nodeId);
const importer  = new Importer(core, rootNode);
await importer.apply(nodeToChange, newState);
// Save using the core
const {rootHash, objects} = core.persist(rootNode);
const branch = this.client.getActiveBranchName();
const startCommit = this.client.getActiveCommitHash();
const project = this.client.getProjectObject();
const commitMsg = `Saved trained neural network: ${snapshot.attributes.name}`;
await project.makeCommit(
    branch,
    [startCommit],
    rootHash,
    objects,
    commitMsg
);