Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I let a 25 MB model choose the typeface for my quote cards. It got it wrong, and I shipped it anyway.

说明与用途

Slothpress 在保持离线、确定性生成的前提下,添加了客户端 MobileBERT 模型来建议字体。模型仅在用户点击时按需加载,且来自同一来源,失败时会显示明确的回退。

问题

Integrating a large language model into a privacy‑first quote‑card generator without compromising the promise that all processing stays on the client.

结果

The app now offers an on‑device style suggestion feature while preserving its deterministic, offline‑only guarantees. The model is loaded only when requested, from the same origin, and a clear fallback is shown if it cannot load.

工作流

  • 1. User types a quote and clicks "Suggest a style".
  • 2. The app dynamically imports @huggingface/transformers and the ONNX Runtime Web runtime from the app’s own origin.
  • 3. The MobileBERT model and tokenizer are fetched from Hugging Face CDN only when the button is pressed.
  • 4. The quote is framed as a premise and each style hypothesis is scored via zero‑shot classification.
  • 5. Scores are normalized and the highest‑scoring preset is applied to the renderer.
  • 6. If the model fails to load, the app displays a plain‑text fallback and counts keywords.
  • 7. The resulting PNG is downloaded by the user.
  • 8. The app logs network activity to confirm no third‑party runtime is requested.

证据

The whole app is one idea, and until this week it had no model in it at all: card = render(content, author, style)

来源

Adding a model could have quietly destroyed that. So the rule was: the model picks a style, and nothing else.

来源

The model is quantized ONNX, 25.72 MB.

来源

Both files land in dist/assets/ and are served from the app's own origin, where the service worker can cache them.

来源

  • 记录日期: 2026-10-21T13:41:20.933Z