How to build scalable web apps with OpenAI's Privacy Filter
OpenAI's open-source Privacy Filter (1.5B params, 50M active, Apache 2.0) detects PII across eight categories in a single forward pass over 128k tokens. Three demo apps built with gradio.Server show how to use it: a document reader that highlights PII spans, an image anonymizer that maps OCR char offsets to pixel redaction boxes on a client-side canvas, and a redacting pastebin with public and token-gated URLs. All three follow one pattern: model calls go through queued @server.api endpoints, which handle ZeroGPU and are callable from both the JS and Python clients, while static pages and cheap lookups stay on plain FastAPI routes.
Related posts
- Any Custom Frontend with Gradio's Backend
Hugging Face mediumAdeptgradio.Server extends FastAPI so any custom frontend (React, Svelte or plain HTML/JS) can sit on top of Gradio's backend, which provides queuing, concurrency control, SSE streaming, gradio_client compatibility and ZeroGPU support on Hugging Face Spaces. A Text Behind Image editor shows the pattern: about 50 lines of Python expose a BiRefNet background-removal endpoint via @app.api() and serve a ~1300-line vanilla HTML/JS app via a normal FastAPI route. The frontend calls the endpoint through the Gradio JS client rather than raw fetch, so requests go through the queue and concurrent GPU calls don't collide.
- Building Private Processing for AI tools on WhatsApp
Meta Engineering hardMasterPrivate Processing lets WhatsApp users send messages to server-side AI features such as summarization and writing suggestions without Meta or WhatsApp being able to read them. Requests run inside confidential VMs, a type of Trusted Execution Environment, with Confidential Compute mode GPUs behind them. Clients authenticate with anonymous credentials and reach the service through an Oblivious HTTP third-party relay that hides their IP and prevents targeting a specific user to a specific machine. They then open an RA-TLS session whose attestation is checked against a third-party log of approved binaries. The service is stateless and forward secure, bans remote shell access, filters logs leaving the CVM, and uses multi-party-reviewed builds, all guided by a threat model covering insiders, supply-chain vendors and malicious users.
- De-identifying text at scale: How Airbnb protects personal data in AI training
Airbnb Engineering mediumAdeptAirbnb de-identifies messages, reviews and support chats before ML training using Presidio, an open-source PII framework, shipped as an in-process Python library and a shared pipeline step whose de-identified dataset tag gates model deployment. The team added Airbnb-specific pattern recognizers with multi-word phrase context scoring, replaced spaCy with the zero-shot GLiNER model for names and street addresses, and resolves overlapping detections in the Anonymizer. Replacement uses realistic custom Faker values seeded from the real value plus a per-run secret, so fakes stay consistent within a run but unlinkable across runs. Structured fields get salted hashing, coordinate truncation and format-preserving encryption for 64-bit IDs. Quality is tracked on recall, precision and throughput per entity and language, with recall prioritized.
- Experimenting with the proposed Cross-Origin Storage API in Transformers.js
Hugging Face mediumAdeptBrowser cache partitioning (in Chrome, keying by Network Isolation Key plus URL) forces every origin running Transformers.js to re-download identical model weights and the ONNX Runtime Wasm file. In the toy example that duplication costs 177 MB for Whisper alone. The proposed Cross-Origin Storage API (navigator.crossOriginStorage) fixes this by addressing files by SHA-256 hash instead of URL, with an OPFS-like getFileHandle interface. It also verifies hashes on write and lets developers scope visibility via an origins list that can be widened but never narrowed. Privacy is handled through availability gating for rarely seen resources, so apps must treat any error as a cache miss. Transformers.js already ships an experimental opt-in COS backend via env.experimental_useCrossOriginStorage, testable today with a polyfill extension.
- Gradio-Lite: Serverless Gradio Running Entirely in Your Browser
Hugging Face mediumAdeptGradio-Lite (@gradio/lite) is a JavaScript library that runs Python Gradio apps entirely in the browser using Pyodide, the WebAssembly build of CPython, so no server is needed. Apps are written in Python inside a <gradio-lite> HTML tag. Multi-file apps use <gradio-file> tags with an entrypoint, and extra dependencies are installed via micropip from a <gradio-requirements> block, for example transformers_js_py for in-browser sentiment classification. The main costs are a 5–15 second initial load while Pyodide downloads and the fact that only Pyodide-compatible packages work.