{"id":18383584,"url":"https://github.com/sashido/teachablemachine-node","last_synced_at":"2025-07-19T16:38:54.904Z","repository":{"id":42001263,"uuid":"287552510","full_name":"SashiDo/teachablemachine-node","owner":"SashiDo","description":"Using Teachable Machine Models in Node.js","archived":false,"fork":false,"pushed_at":"2024-04-21T03:48:17.000Z","size":59,"stargazers_count":54,"open_issues_count":2,"forks_count":14,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-18T05:55:38.752Z","etag":null,"topics":["computer-vision","machine-learning","nodejs","teachablemachine","tensorflowjs"],"latest_commit_sha":null,"homepage":"https://teachablemachine.withgoogle.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SashiDo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-14T14:31:13.000Z","updated_at":"2025-01-24T04:28:07.000Z","dependencies_parsed_at":"2024-06-18T20:11:42.573Z","dependency_job_id":null,"html_url":"https://github.com/SashiDo/teachablemachine-node","commit_stats":{"total_commits":12,"total_committers":4,"mean_commits":3.0,"dds":0.5833333333333333,"last_synced_commit":"e5e3ec05a846c92fff593647c2a72e813a1af2f1"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SashiDo%2Fteachablemachine-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SashiDo%2Fteachablemachine-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SashiDo%2Fteachablemachine-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SashiDo%2Fteachablemachine-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SashiDo","download_url":"https://codeload.github.com/SashiDo/teachablemachine-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569128,"owners_count":20959758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","machine-learning","nodejs","teachablemachine","tensorflowjs"],"created_at":"2024-11-06T01:11:54.500Z","updated_at":"2025-04-06T23:32:26.173Z","avatar_url":"https://github.com/SashiDo.png","language":"JavaScript","readme":"# Teachable Machine Node\n\n![teachable-machine-cover](https://media-blog.sashido.io/content/images/2020/09/teachable-machine-cover.png)\n\n# About\n\n**Teachable Machine Node** empowers you to load any image classification model trained with Google's Teachable Machine tool in a Node.Js project.\n\n[Teachable Machine](https://teachablemachine.withgoogle.com/) makes AI easy for everyone, by offering a fast and fun way to train a real TensorFlow.js Machine Learning Models without any coding required. You can train the computer to recognize images, sounds, \u0026 poses, using your camera or your own dataset. Check [The Awesome Teachable Machine List](https://github.com/SashiDo/awesome-teachable-machine) full of useful resources and amazing projects to gain some cool ideas.\n\n\nFor now, Teachable Machine Node holds support only for image models, but we won't stop here. Check out the [Roadmap](#Roadmap) of what comes next!\n\n# Install\n\n- Install using npm\n\n```sh\nnpm install @sashido/teachablemachine-node\n```\n\n- Install using yarn\n\n```sh\nyarn add @sashido/teachablemachine-node\n```\n\n\n# Usage\n\n### Create you own Model with Teachable Machine\n\n1. [Gathering samples](https://youtu.be/DFBbSTvtpy4) is the fundamental first step to your Teachable Machine Model. Use your camera to collect data or upload some preselected images.\n\n2. [Train your Teachable Machine Image Model](https://teachablemachine.withgoogle.com/train?action=onboardOpen\u0026id=CO67EQ0ZWgA).\n\n![](https://media-blog.sashido.io/content/images/2020/09/tm_export_model.png)\n\nCheck the `Advanced` option for further insights on the model performance and accuracy. Once certain it returns valid results, hit the Export option.\n\n3. Make sure that you select Tensorflow.js format when exporting. That way your model will be uploaded (for free) and you will receive an access URL.\n\n![  ](https://media-blog.sashido.io/content/images/2020/08/export_tendorflow.js.png)\n\n4. Pass the URL to the teachablemachine-node to load the model. Next, let it have the image and call `classify` to get the predictions. You can pass the image URL or deliver it in base 64. It's up to your preference.\n\n### Play around with our pre-trained 'Is It A Dog?' model.\n\nSashiDo's team is full of notorious animal lovers and no wonder the sample model was trained to recognize dog pics from other images. 😊 We've collected a dataset of more than 2000 images of dogs, cats, horses, other animals, people and everyday objects and uploaded them into two different classes with Teachable Machine.\n\n![](https://media-blog.sashido.io/content/images/2020/09/example.gif)\n\nA big shoutout to [Unsplash.com](https://unsplash.com/) as a great platform for free photos. Check it out in case you're just starting and do not have raw data yet.\n\nYou can load our **Is_It_A_Dog** model using this URL and following the example below:\n\n```\nhttps://teachablemachine.withgoogle.com/models/r6BBk-hiN/\n```\n\n# Examples\n\n### NodeJS\n\nHere's a quick example of how to load the model in your project.\n\n```javascript\nconst TeachableMachine = require(\"@sashido/teachablemachine-node\");\n\nconst model = new TeachableMachine({\n  modelUrl: \"https://teachablemachine.withgoogle.com/models/r6BBk-hiN/\"\n});\n\nmodel.classify({\n  imageUrl: \"https://media-blog.sashido.io/content/images/2020/09/SashiDo_Dog.jpg\",\n}).then((predictions) =\u003e {\n  console.log(\"Predictions:\", predictions);\n}).catch((e) =\u003e {\n  console.log(\"ERROR\", e);\n});\n```\n\n### ExpressJS\n\nAnd the alternative for all Express fans.\n\n```javascript\nconst express = require(\"express\");\nconst TeachableMachine = require(\"@sashido/teachablemachine-node\");\n\nconst model = new TeachableMachine({\n  modelUrl: \"https://teachablemachine.withgoogle.com/models/r6BBk-hiN/\"\n});\n\nconst app = express();\nconst port = 3000;\n\napp.get(\"/image/classify\", async (req, res) =\u003e {\n  const { url } = req.query;\n\n  return model.classify({\n    imageUrl: url,\n  }).then((predictions) =\u003e {\n    console.log(predictions);\n    return res.json(predictions);\n  }).catch((e) =\u003e {\n    console.error(e);\n    res.status(500).send(\"Something went wrong!\")\n  });\n});\n\napp.listen(port, () =\u003e {\n  console.log(`Example app listening at http://localhost:${port}`);\n});\n```\n\n# Roadmap\n\nIn the long run, we will add more options, so you can train and load all kinds of Teachable Machine Models.\n\n 1. Add support for Pose Models.\n\n 2. Add support for Audio Models.\n\n 3. Add support for Gifs.\n\n 4. Add support for Videos.\n\nWe would love to have your opinion which's the one you would like to see supported first. Don't be shy and drop us a line at hello@sashido.io.\n\n# Contribute\n\nContributors of any kind are welcome. Share your awesome improvements in a pull request and join our mission to make Machine Learning more affordable \u0026 accessible!\n\n# License\n\nCopyright © 2020, CloudStrap AD. See [LICENSE](https://github.com/SashiDo/teachablemachine-node/blob/master/LICENSE) for further details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsashido%2Fteachablemachine-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsashido%2Fteachablemachine-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsashido%2Fteachablemachine-node/lists"}