显示HN:通过ONNX Runtime Web,苹果的锐利浏览器运行
Show HN: Apple's Sharp Running in the Browser via ONNX Runtime Web

原始链接: https://github.com/bring-shrubbery/ml-sharp-web

这个项目是一个基于浏览器的各向异性高斯飞溅生成器,利用了苹果的SHARP技术。用户可以上传单张图片,直接在浏览器中生成3D各向异性高斯飞溅表示,预览结果,并将其下载为.ply文件。 它需要Bun进行设置,以及现代浏览器(推荐Chrome/Edge),并需要足够的磁盘空间(约2.4GB)来存储SHARP模型。该项目使用ONNX Runtime Web进行推理,并包含一个React/TypeScript用户界面。 **关键点:** * **许可:** 苹果SHARP的代码和模型权重有单独的许可协议——权重有研究限制。 * **模型文件:** 需要同时提供`.onnx`和`.onnx.data`文件,并且它们必须从同一个文件夹提供服务。默认情况下使用托管模型。 * **性能:** 基于浏览器的推理需要大量资源;性能因硬件和浏览器支持而异。 * **设置:** 在使用之前,需要克隆SHARP仓库并将模型导出为ONNX格式。 这是一个实验性原型,提供了一种探索各向异性高斯飞溅生成,而无需外部依赖的便捷方式,但性能可能有限。

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 展示HN:苹果通过ONNX Runtime Web在浏览器中实现高效运行 (github.com/bring-shrubbery) 5点 由 bring-shrubbery 1小时前 | 隐藏 | 过去 | 收藏 | 讨论 帮助 考虑申请YC 2026年夏季项目!申请截止至5月4日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请YC | 联系 搜索:
相关文章

原文

ml-sharp-web preview

A browser-based Gaussian splat generator built on top of Apple SHARP. ✨

This project lets you:

  • upload one image
  • generate Gaussian splats in the browser
  • preview the result
  • download a .ply file

Before you start (important license note)

Apple's SHARP repository has separate licenses for code and model weights.

If you use Apple's released SHARP checkpoint/weights, you must follow LICENSE_MODEL (research-use restrictions apply).

  • Bun installed
  • A modern desktop browser (Chrome or Edge recommended)
  • Enough disk space and RAM for the SHARP model (the exported ONNX sidecar is large, ~2.4 GB)

Quick start (run the app) 🚀

If this project helps you, please star it:

This also copies ONNX Runtime Web WASM assets into public/ort/ automatically.

Open the URL shown by Vite (usually http://localhost:5173).

  1. Upload an image.
  2. Click Generate Splat.
  3. Preview the result and download the .ply file.

Important model file note (.onnx + .onnx.data)

SHARP exports usually produce two files:

  • sharp_web_predictor.onnx
  • sharp_web_predictor.onnx.data

Both files must be served together from the same folder (for example public/models/).

Why this matters:

  • The .onnx file is only the graph and metadata.
  • The .onnx.data file contains most of the model weights.

For that reason, the app uses the hosted model by default. Uploading only the .onnx file directly in the browser usually will not work because the .onnx.data sidecar is separate.

Export the SHARP model to ONNX (beginner-friendly steps)

Everything runs in the browser, but you still need an exported SHARP ONNX model.

1. Clone Apple's SHARP repo (reference code)

git clone https://github.com/apple/ml-sharp /tmp/ml-sharp-upstream

2. Prepare a Python environment for export

You need Python + SHARP dependencies + ONNX export dependencies.

The easiest route is to follow the upstream SHARP setup first, then run this exporter script from this repo.

3. Export the browser predictor ONNX

From this repo:

python3 scripts/export_sharp_onnx.py \
  --sharp-repo /tmp/ml-sharp-upstream \
  --output public/models/sharp_web_predictor.onnx

If the model is large (it is), the script will also write:

public/models/sharp_web_predictor.onnx.data
  • --checkpoint /path/to/sharp_2572gikvuh.pt to use a manually downloaded checkpoint
  • --device cuda to export on GPU (if your environment supports it)
  • --opset 20 to change ONNX opset (default is 20)

If you want a static build instead of running bun dev:

bun run build
bun run preview

Notes:

  • bun run build copies public/ into dist/, including the model files.
  • If sharp_web_predictor.onnx.data is present, the build output will be very large.

How it works (high level)

  • React + TypeScript UI (src/)
  • ONNX Runtime Web worker for inference (src/workers/sharpWorker.ts)
  • Browser-side SHARP postprocessing (NDC -> metric gaussian conversion)
  • Browser-side PLY writer
  • In-page preview with @mkkellogg/gaussian-splats-3d

"expected magic word ... found 3c 21 64 6f" (WASM error)

This means a WASM file request returned HTML instead.

Try:

  • run the app with bun dev (not file://...)
  • restart the dev server after bun install
  • verify these load in your browser:
    • /ort/ort-wasm-simd-threaded.asyncify.mjs
    • /ort/ort-wasm-simd-threaded.asyncify.wasm

"Failed to load external data file ... sharp_web_predictor.onnx.data"

This means the ONNX sidecar file is missing or not served correctly.

Check:

  • public/models/sharp_web_predictor.onnx
  • public/models/sharp_web_predictor.onnx.data
  • The app can reach the hosted model files in your deployment/browser environment

The app runs, but generation is very slow or crashes

SHARP is large and browser inference is heavy.

Try:

  • Chrome or Edge (desktop)
  • smaller Max gaussians in the UI
  • closing other memory-heavy tabs/apps
  • waiting longer on first run (model + runtime initialization can take time)

Working prototype / experimental. 🧪

The app runs end-to-end in the browser, but performance and compatibility depend heavily on browser WebGPU/WASM support and your machine's available memory.

联系我们 contact @ memedata.com