diff --git a/routes/vision.js b/routes/vision.js new file mode 100644 index 0000000..7df1173 --- /dev/null +++ b/routes/vision.js @@ -0,0 +1,14 @@ +import express from 'express'; +import * as tf from '@tensorflow/tfjs'; +import * as cocoSsd from '@tensorflow-models/coco-ssd'; + +const router = express.Router(); +const model = await cocoSsd.load(); + +router.post('/object-detection', async (req, res) => { + const { image } = req.body; + const predictions = await model.detect(image); + res.json({ predictions }); +}); + +export default router;