We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4ba87a commit c6e0176Copy full SHA for c6e0176
routes/neural-network.js
@@ -0,0 +1,19 @@
1
+import express from 'express';
2
+import * as brain from 'brain.js';
3
+
4
+const router = express.Router();
5
+const net = new brain.NeuralNetwork();
6
7
+router.post('/train-neural-network', (req, res) => {
8
+ const { trainingData } = req.body;
9
+ net.train(trainingData);
10
+ res.json({ trainingError: net.error });
11
+});
12
13
+router.post('/make-prediction', (req, res) => {
14
+ const { inputData } = req.body;
15
+ const output = net.run(inputData);
16
+ res.json({ output });
17
18
19
+export default router;
0 commit comments