Skip to content

Commit

Permalink
Create vision.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 22, 2024
1 parent 1de8aab commit 56e2f36
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions routes/vision.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 56e2f36

Please sign in to comment.