Skip to content

Commit

Permalink
Merge pull request #126 from camicroscope/develop
Browse files Browse the repository at this point in the history
Revert TFJS skip for now
  • Loading branch information
birm authored Aug 19, 2021
2 parents 4d3cba3 + 6e25ae0 commit 63b3aab
Show file tree
Hide file tree
Showing 5 changed files with 4,139 additions and 38 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ RUN mkdir /src
COPY . /src
WORKDIR /src
RUN npm install
ARG DISABLE_TF
RUN if [ "${DISABLE_TF:-false}" = "true" ] ; then echo "Disabled TF"; else npm install @tensorflow/tfjs && echo "installed"; fi
ARG viewer
ARG fork
RUN git clone https://github.com/${fork:-camicroscope}/camicroscope.git --branch=${viewer:-master}
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ All possible configuration variables are listed in `.env.example`. Renaming the
|EXPIRY | expire in time for jwks| 1d |
|DISABLE_SEC | set truthy to disable permission and login handlers | false |
|DISABLE_CSP | set truthy to disable content security policy headers | false |
|DISABLE_TF | set to "true" to disable installing and using tensorflow. If using a dockerfile, set the same value for a build argument. | false |
|ALLOW_PUBLIC | set truthy to allow public users | false |
|IIP_PATH | IIP server location | http://ca-iip |
|MONGO_URI | mongo connection uri | mongodb://localhost |
Expand Down
33 changes: 7 additions & 26 deletions caracal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const proxyHandler = require('./handlers/proxyHandler.js');
const permissionHandler = require('./handlers/permssionHandler.js');
const dataHandlers = require('./handlers/dataHandlers.js');
const sanitizeBody = require('./handlers/sanitizeHandler.js');

const DataSet = require('./handlers/datasetHandler.js');
const Model = require('./handlers/modelTrainer.js');
const DataTransformationHandler = require('./handlers/dataTransformationHandler.js');
// TODO validation of data

Expand All @@ -33,14 +34,6 @@ var MONGO_URI = process.env.MONGO_URI || 'mongodb://localhost';

var DISABLE_CSP = process.env.DISABLE_CSP || false;

var DISABLE_TF = process.env.DISABLE_TF || false;


if (!DISABLE_TF) {
const DataSet = require('./handlers/datasetHandler.js');
const Model = require('./handlers/modelTrainer.js');
}

const app = express();
app.use(cookieParser());

Expand Down Expand Up @@ -86,6 +79,10 @@ var HANDLERS = {
"permissionHandler": permissionHandler,
"editHandler": auth.editHandler,
"proxyHandler": proxyHandler,
"getDataset": DataSet.getDataset,
"trainModel": Model.trainModel,
"deleteDataset": DataSet.deleteData,
"sendTrainedModel": Model.sendTrainedModel,
"iipHandler": function() {
return iipHandler;
},
Expand Down Expand Up @@ -118,23 +115,6 @@ var HANDLERS = {
},
};

if (!DISABLE_TF) {
HANDLERS["getDataset"] = DataSet.getDataset;
HANDLERS["trainModel"] = Model.trainModel;
HANDLERS["deleteDataset"] = DataSet.deleteData;
HANDLERS["sendTrainedModel"] = Model.sendTrainedModel;
} else {
function disabledRoute() {
return function(req, res) {
res.status(500).send('{"err":"This TF route is disabled"}');
};
}
HANDLERS["getDataset"] = disabledRoute;
HANDLERS["trainModel"] = disabledRoute;
HANDLERS["deleteDataset"] = disabledRoute;
HANDLERS["sendTrainedModel"] = disabledRoute;
}

// register configurable services
// TODO verify all
for (let i in routeConfig) {
Expand Down Expand Up @@ -231,3 +211,4 @@ connector.init().then(() => {
});

module.exports = app; // for tests

Loading

0 comments on commit 63b3aab

Please sign in to comment.