{"id":51493984,"url":"https://github.com/kiritocode1/litert.js","last_synced_at":"2026-07-07T13:01:50.832Z","repository":{"id":326028069,"uuid":"1103534768","full_name":"kiritocode1/litert.js","owner":"kiritocode1","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-25T02:14:04.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-11T13:57:50.699Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiritocode1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-25T02:06:19.000Z","updated_at":"2025-11-25T02:14:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kiritocode1/litert.js","commit_stats":null,"previous_names":["kiritocode1/litert.js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kiritocode1/litert.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiritocode1%2Flitert.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiritocode1%2Flitert.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiritocode1%2Flitert.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiritocode1%2Flitert.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiritocode1","download_url":"https://codeload.github.com/kiritocode1/litert.js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiritocode1%2Flitert.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35228639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-07T02:00:07.222Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-07-07T13:01:47.541Z","updated_at":"2026-07-07T13:01:50.822Z","avatar_url":"https://github.com/kiritocode1.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LiteRT.js Model Inference - Browser-Based ML Runtime\n\n🎥 **Video Tutorial**: [Watch on YouTube](https://youtu.be/DFZGcZXiiLE?si=4Avs3knkFsnxr4Hz)\n\nRun TensorFlow Lite models directly in your browser using Google\u0026apos;s LiteRT.js runtime. No server-side processing required - everything runs locally in your browser with WebAssembly acceleration.\n\n## 🚀 Features\n\n-   **Browser-Based Inference**: Run ML models entirely in your browser - no data sent to servers\n-   **WebAssembly Acceleration**: Fast CPU inference via XNNPack-optimized WASM\n-   **WebGPU Support**: GPU acceleration for Chromium-based browsers\n-   **GPT-2 Compatible**: Optimized for transformer models like GPT-2\n-   **Interactive UI**: Visual pipeline explanation with real-time inference results\n-   **Export Results**: Download inference results as JSON or copy to clipboard\n\n## 📋 Requirements\n\n-   Bun runtime (v1.3.2+)\n-   Modern browser with WebAssembly support\n-   `.tflite` model files\n\n## 🛠️ Installation\n\n```bash\n# Install dependencies\nbun install\n\n# Start the server\nbun run index.ts\n```\n\nServer runs at `http://localhost:3000`\n\n## 📖 Usage\n\n1. **Start the server**: `bun run index.ts`\n2. **Open browser**: Navigate to `http://localhost:3000`\n3. **Upload model**: Click \u0026quot;Upload Model\u0026quot; and select a `.tflite` file\n4. **Run inference**: Click \u0026quot;Run Inference\u0026quot; to execute the model\n5. **View results**: Check the console output for detailed results\n6. **Export data**: Download results as JSON or copy to clipboard\n\n## 🎯 How It Works\n\nThe application demonstrates the complete ML inference pipeline:\n\n1. **Load LiteRT**: Initialize WebAssembly runtime files\n2. **Compile Model**: Load and compile `.tflite` model for execution\n3. **Prepare Input**: Create input tensors matching model requirements\n4. **Run Inference**: Execute model on CPU/GPU accelerator\n5. **Process Outputs**: Extract and analyze output tensors\n\n## 📊 Understanding the Results\n\n### JSON Output Structure\n\n```json\n{\n  \"metadata\": {\n    \"description\": \"LiteRT.js Model Inference Results\",\n    \"timestamp\": \"2025-01-XX...\",\n    \"model\": \"GPT-2 LiteRT Model\"\n  },\n  \"outputs\": [\n    {\n      \"name\": \"Identity\",\n      \"data\": [numbers...],\n      \"shape\": [1, 64, 50257],\n      \"dtype\": \"float32\",\n      \"stats\": {\n        \"min\": -15.0627,\n        \"max\": 16.7778,\n        \"mean\": -0.0060,\n        \"std\": 2.6681\n      },\n      \"totalElements\": 3216448\n    }\n  ]\n}\n```\n\n### Field Explanations\n\n-   **data**: Raw prediction numbers from the model\n-   **shape**: Tensor dimensions `[batch, ...dimensions]`\n-   **dtype**: Data type (`float32` for decimals, `int32` for integers)\n-   **stats**: Statistics calculated from the output data\n-   **totalElements**: Total number of values in the tensor\n\n### For GPT-2 Models\n\n-   **Logits** (`[1, 64, 50257]`): Probability scores for each of 50,257 possible next tokens\n-   **Hidden States** (`[1, 2, 12, 64, 64]`): Layer-wise representations from transformer layers\n\n## 🔧 Technical Details\n\n-   **Runtime**: LiteRT.js (Google\u0026apos;s WebAI runtime)\n-   **Acceleration**: WebAssembly (XNNPack) for CPU, WebGPU for GPU\n-   **Model Format**: TensorFlow Lite (`.tflite`)\n-   **Framework**: Bun + TypeScript\n-   **UI**: Vanilla HTML/CSS/TypeScript\n\n## 📁 Project Structure\n\n```\nmlmodel/\n├── index.ts          # Bun server (serves HTML + WASM files)\n├── app.html          # Main UI with pipeline explanations\n├── app.ts            # Browser-side inference logic\n├── package.json      # Dependencies\n└── README.md         # This file\n```\n\n## 🌐 Finding Models\n\nDownload `.tflite` models from:\n\n-   **[HuggingFace](https://huggingface.co/models?library=tflite)** - Search for TFLite models\n-   **[Kaggle](https://www.kaggle.com/models?framework=tfLite)** - Browse TFLite models\n\n## 🔒 Privacy\n\n-   All inference runs entirely in your browser\n-   No data is sent to external servers\n-   Models and results stay on your machine\n\n## 📝 License\n\nMIT License - feel free to use and modify.\n\n## 🔗 Links\n\n-   **Website**: https://aryank.space/\n-   **Channel**: BLANK SPACE TECH\n\n## 🙏 Credits\n\nBuilt with [LiteRT.js](https://ai.google.dev/edge/litert/web) by Google.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiritocode1%2Flitert.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiritocode1%2Flitert.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiritocode1%2Flitert.js/lists"}