Starting TensorFlow integration

This commit is contained in:
Luis Fernando Molina committed 2021-02-11 15:25:48 +01:00
1 parent ad61c92758
commit 09e4d26ceb
7 files changed
+166 -23

No files matched your search

+31 -23
View File
@@ -1139,22 +1139,24 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
fs.readdir(dirPath, onDirRead)
function onDirRead(err, fileList) {
let updatedFileList = []
if (err) {
console.log('[WARN] Error reading a directory content. filePath = ' + dirPath)
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
/*
If we have a problem reading this folder we will assume that it is
because this project does not need this folder and that's it.
*/
//console.log('[WARN] Error reading a directory content. filePath = ' + dirPath)
} else {
let updatedFileList = []
for (let i = 0; i < fileList.length; i++) {
let name = 'Plugin \u2192 ' + fileList[i]
updatedFileList.push([project, name])
}
allWorkspaces = allWorkspaces.concat(updatedFileList)
projectsCount++
if (projectsCount === projects.length) {
readMyWorkspaces()
}
return
}
allWorkspaces = allWorkspaces.concat(updatedFileList)
projectsCount++
if (projectsCount === projects.length) {
readMyWorkspaces()
}
}
} catch (err) {
@@ -1441,21 +1443,23 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
fs.readdir(dirPath, onDirRead)
function onDirRead(err, fileList) {
let updatedFileList = []
if (err) {
console.log('[WARN] Error reading a directory content. filePath = ' + dirPath)
return
/*
If we have a problem reading this folder we will assume that it is
because this project does not need this folder and that's it.
*/
// console.log('[WARN] Error reading a directory content. filePath = ' + dirPath)
} else {
let updatedFileList = []
for (let i = 0; i < fileList.length; i++) {
let name = fileList[i]
updatedFileList.push([project, name])
}
allLibraries = allLibraries.concat(updatedFileList)
projectsCount++
if (projectsCount === projects.length) {
respondWithContent(JSON.stringify(allLibraries), httpResponse)
}
return
}
allLibraries = allLibraries.concat(updatedFileList)
projectsCount++
if (projectsCount === projects.length) {
respondWithContent(JSON.stringify(allLibraries), httpResponse)
}
}
} catch (err) {
@@ -1722,9 +1726,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
function getDirectories(path) {
const fs = require('fs')
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + '/' + file).isDirectory();
});
try {
const fs = require('fs')
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + '/' + file).isDirectory();
});
} catch (err) {
return []
}
}
}
BIN
View File
Binary file not shown.
+10
View File
@@ -914,5 +914,15 @@
},
"TS": {},
"CL": {}
},
{
"name": "TensorFlow",
"propertyName": "tensorflow",
"UI": {
"globals": [],
"functionLibraries": [],
"utilities": [],
"spaces": []
}
}
]
@@ -12684,6 +12684,11 @@
"name": "trainingData",
"type": "array",
"childType": "Training Data"
},
{
"name": "machineLearningLibrary",
"type": "node",
"childType": "TensorFlow Library"
}
]
},
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

@@ -0,0 +1,90 @@
[
{
"type": "TensorFlow Project",
"menuItems": [
{
"action": "Add UI Object",
"label": "Add TensorFlow",
"relatedUiObject": "TensorFlow",
"actionFunction": "payload.executeAction"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"actionFunction": "payload.executeAction",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity"
}
],
"isProjectHead": true,
"isTitleAllwaysVisible": false,
"addLeftIcons": true,
"isPinned": true,
"positionLocked": true,
"childrenNodesProperties": [
{
"name": "projectDefinition",
"type": "node",
"childType": "Project Definition",
"project": "Superalgos",
"autoAdd": true
}
],
"icon": "tensorflow"
},
{
"type": "TensorFlow",
"menuItems": [
{
"action": "Add UI Object",
"label": "Add Library",
"relatedUiObject": "TensorFlow Library",
"actionFunction": "payload.executeAction"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"isHierarchyHead": true,
"addLeftIcons": true,
"level": 0,
"childrenNodesProperties": [
{
"name": "machineLearningLibrary",
"type": "node",
"childType": "TensorFlow Library",
"autoAdd": true
}
],
"icon": "tensorflow"
},
{
"type": "TensorFlow Library",
"menuItems": [
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"addLeftIcons": true,
"level": 3,
"attachingRules": {
"compatibleTypes": "->Learning System->"
},
"propertyNameAtParent": "machineLearningLibrary",
"icon": "tensorflow"
}
]
@@ -0,0 +1,30 @@
function newTensorFlowActionSwitch() {
let thisObject = {
executeAction: executeAction,
initialize: initialize,
finalize: finalize
}
return thisObject
function finalize() {
}
function initialize() {
/* Nothing to initialize since a Function Library does not hold any state. */
}
async function executeAction(action) {
switch (action.name) {
/*
case 'Create Wallet Account': {
UI.projects.ethereum.functionLibraries.accounts.createWalletAccount(action.node)
break
}
*/
}
}
}