{"id":28136653,"url":"https://github.com/phun-ky/wrapture","last_synced_at":"2026-02-10T13:01:27.902Z","repository":{"id":293266279,"uuid":"983380230","full_name":"phun-ky/wrapture","owner":"phun-ky","description":"Wrapture lets you go from a Python-trained model to deployable JavaScript with a single command. It generates TypeScript bindings and a Web/Node-compatible wrapper, using WebGPU/WASM-ready ONNX runtimes.","archived":false,"fork":false,"pushed_at":"2026-02-02T11:45:44.000Z","size":2822,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-07T19:36:08.504Z","etag":null,"topics":["javascript","machine-learning","model","model-conversion","onnx","pytorch","quantization","simplifier","typescript","wasm","webgpu","wrapture"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phun-ky.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"phun-ky","custom":["https://www.paypal.me/phunky"]}},"created_at":"2025-05-14T09:47:42.000Z","updated_at":"2026-01-27T07:44:04.000Z","dependencies_parsed_at":"2025-06-02T14:30:05.715Z","dependency_job_id":"fe526633-ce27-493c-bc94-e21506e0e6e2","html_url":"https://github.com/phun-ky/wrapture","commit_stats":null,"previous_names":["phun-ky/wrapture"],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/phun-ky/wrapture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fwrapture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fwrapture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fwrapture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fwrapture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phun-ky","download_url":"https://codeload.github.com/phun-ky/wrapture/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phun-ky%2Fwrapture/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29299540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T12:55:56.056Z","status":"ssl_error","status_checked_at":"2026-02-10T12:55:55.692Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["javascript","machine-learning","model","model-conversion","onnx","pytorch","quantization","simplifier","typescript","wasm","webgpu","wrapture"],"created_at":"2025-05-14T16:19:51.627Z","updated_at":"2026-02-10T13:01:27.437Z","avatar_url":"https://github.com/phun-ky.png","language":"TypeScript","funding_links":["https://github.com/sponsors/phun-ky","https://www.paypal.me/phunky"],"categories":[],"sub_categories":[],"readme":"# Wrapture\n\n\u003cp align=\"center\" width=\"100%\"\u003e\n    \u003cimg width=\"256px\" src=\"./public/wrapture-logo-small.png\" alt=\"wrapture logo\" /\u003e\n\u003c/p\u003e\n\n\u003e One-click exporter from PyTorch models to Web-ready ONNX with JS/TS wrappers.\n\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](http://makeapullrequest.com)\n[![SemVer 2.0](https://img.shields.io/badge/SemVer-2.0-green.svg)](http://semver.org/spec/v2.0.0.html)\n![npm version](https://img.shields.io/npm/v/wrapture)\n![issues](https://img.shields.io/github/issues/phun-ky/wrapture)\n![license](https://img.shields.io/npm/l/wrapture)\n![size](https://img.shields.io/bundlephobia/min/wrapture)\n![npm](https://img.shields.io/npm/dm/wrapture)\n![GitHub Repo stars](https://img.shields.io/github/stars/phun-ky/wrapture)\n[![codecov](https://codecov.io/gh/phun-ky/wrapture/graph/badge.svg?token=VA91DL7ZLZ)](https://codecov.io/gh/phun-ky/wrapture)\n[![build](https://github.com/phun-ky/wrapture/actions/workflows/check.yml/badge.svg)](https://github.com/phun-ky/wrapture/actions/workflows/check.yml)\n\n## About\n\nWrapture lets you go from a Python-trained model to deployable JavaScript with a\nsingle command. It generates TypeScript bindings and a Web/Node-compatible\nwrapper, using WebGPU/WASM-ready ONNX runtimes.\n\n\u003e [!NOTE]\n\u003e This is an experiment trying to fulfil a need between python and js.\n\u003e YMMV\n\n## Table of Contents\u003c!-- omit from toc --\u003e\n\n- [Wrapture](#-wrapture)\n  - [About](#about)\n  - [🚀 Features](#-features)\n  - [Prerequisites](#prerequisites)\n    - [Python 3.10+ required](#python-310-required)\n    - [Install required Python packages](#install-required-python-packages)\n  - [Installation](#installation)\n  - [Generating a Model](#generating-a-model)\n  - [Usage](#usage)\n  - [Output Structure](#output-structure)\n  - [Example: Using the Generated Model](#example-using-the-generated-model)\n  - [API](#api)\n  - [Contributing](#contributing)\n  - [License](#license)\n  - [Changelog](#changelog)\n  - [Sponsor me](#sponsor-me)\n\n## 🚀 Features\n\n- ✅ Convert PyTorch models to ONNX\n- ✅ Optional ONNX simplification and quantization\n- ✅ Generate `loadModel()` + `predict()` JavaScript wrappers\n- ✅ Auto-generate `.d.ts` TypeScript bindings\n\n---\n\n## Prerequisites\n\n### Python 3.10+ required\n\nInstall Python if you don’t have it: 👉 \u003chttps://www.python.org/downloads/\u003e\n\n---\n\n### Install required Python packages\n\n```shell-session\npython3 -m pip install torch onnx onnxsim onnxruntime\n```\n\nCheck your installation:\n\n```shell-session\npython3 -c \"import torch; print(torch.__version__)\"\npython3 -c \"import onnx; print(onnx.__version__)\"\n```\n\nYou should see output like:\n\n`2.x.x` etc..\n\n## Installation\n\n```shell-session\nnpm i -g wrapture\n```\n\n## Generating a Model\n\nA helper script is provided to create a basic test model.\n\n```shell-session\npython3 python/scripts/basic_model.py\n```\n\nThis generates:\n\n```shell-session\ntest/fixtures/basic_model.pt\n```\n\n## Usage\n\n```shell-session\nwrapture --input test/fixtures/basic_model.pt --output ./wrapped\n```\n\nYou’ll see a spinner as the model is converted, and then a JS/TS wrapper is\nwritten to the ./wrapped/ directory.\n\n## Output Structure\n\nExample contents of a `--output ./` folder:\n\n```shell-session\n/\n ├── wrapped.ts # The loadModel() + predict() logic\n ├── wrapped.d.ts # Fully typed API\n └── model.onnx # Exported ONNX model\n```\n\n## Example: Using the Generated Model\n\n```ts\nimport { loadModel } from './wrapped.js';\n\nconst model = await loadModel();\n\nconst input = { data: new Float32Array(1 _3_ 224 \\* 224), dims: [1, 3, 224, 224]\n};\n\nconst result = await model.predict(input); console.log(result); // { // logits:\nFloat32Array, // probabilities: number[], // predictedClass: number // }\n```\n\n---\n\n## API\n\nFull API documentation is available\n[here](https://github.com/phun-ky/wrapture/blob/main/api/README.md).\n\n---\n\n## Contributing\n\nWant to contribute? Please read the\n[CONTRIBUTING.md](https://github.com/phun-ky/wrapture/blob/main/CONTRIBUTING.md)\nand\n[CODE_OF_CONDUCT.md](https://github.com/phun-ky/wrapture/blob/main/CODE_OF_CONDUCT.md)\n\n## License\n\nThis project is licensed under the MIT License - see the\n[LICENSE](https://github.com/phun-ky/wrapture/blob/main/LICENSE) file for\ndetails.\n\n## Changelog\n\nSee the\n[CHANGELOG.md](https://github.com/phun-ky/wrapture/blob/main/CHANGELOG.md) for\ndetails on the latest updates.\n\n## Sponsor me\n\nI'm an Open Source evangelist, creating stuff that does not exist yet to help\nget rid of secondary activities and to enhance systems already in place, be it\ndocumentation or web sites.\n\nThe sponsorship is an unique opportunity to alleviate more hours for me to\nmaintain my projects, create new ones and contribute to the large community\nwe're all part of :)\n\n[Support me on GitHub Sponsors](https://github.com/sponsors/phun-ky).\n\np.s. **Ukraine is still under brutal Russian invasion. A lot of Ukrainian people\nare hurt, without shelter and need help**. You can help in various ways, for\ninstance, directly helping refugees, spreading awareness, putting pressure on\nyour local government or companies. You can also support Ukraine by donating\ne.g. to [Red Cross](https://www.icrc.org/en/donate/ukraine),\n[Ukraine humanitarian organisation](https://savelife.in.ua/en/donate-en/#donate-army-card-weekly)\nor\n[donate Ambulances for Ukraine](https://www.gofundme.com/f/help-to-save-the-lives-of-civilians-in-a-war-zone).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphun-ky%2Fwrapture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphun-ky%2Fwrapture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphun-ky%2Fwrapture/lists"}