Use the Cloudflare-specific scripts below.
npm run deploy:cfdeploys the top-level environment toworkers.dev.npm run deploy:cf:stagingdeploys thestagingenvironment.
These scripts run a cleanup step that removes generated ONNX Runtime wasm artifacts from dist/browser/wasm before upload. The app already loads ONNX wasm binaries from CDN in the web worker, so this prevents Wrangler's 25 MiB asset-limit error during deploy.
The worker tries model URLs in this order:
/assets/models/model_quantized.onnx/assets/models/model.onnx- Optional fallback URL(s) from runtime config
Place the original ONNX model at:
public/assets/models/model.onnx
Run:
python quantize.pyThis generates:
public/assets/models/model_quantized.onnx
Verify size before deploy:
ls -lh public/assets/models/model*.onnxYou can provide one or more fallback model URLs when the local asset is not available.
Set in src/index.html before the Angular bundle:
<script>
window.REMOVEBG_MODEL_URL = 'https://your-cdn.example.com/model_quantized.onnx';
// or:
// window.REMOVEBG_MODEL_URLS = [
// 'https://primary-cdn.example.com/model_quantized.onnx',
// 'https://backup-cdn.example.com/model_quantized.onnx'
// ];
</script>Or set at runtime from DevTools/local scripts:
localStorage.setItem('removebg.modelUrl', 'https://your-cdn.example.com/model_quantized.onnx');npm run build:cf
du -sh dist/browserIf your model still pushes assets above Cloudflare free-tier limits, host the model externally and keep only app code in the deployed asset bundle.