---
title: "How to build scalable web apps with OpenAI's Privacy Filter"
description: "The article presents three web applications built around OpenAI’s open-source Privacy Filter, a PII detector that labels eight categories in one forward pass over a 128k-token context. Document Privacy Explorer extracts PDF or DOCX text and returns category-labeled spans, while Image Anonymizer combines Tesseract word boxes with character offsets to produce editable pixel redaction rectangles. SmartRedact Paste replaces detected spans with category placeholders, stores public and token-gated views, and evicts expired pastes in a daemon thread. Across the apps, gradio.Server’s @server.api routes model work through Gradio’s queue and gradio_client, while plain FastAPI routes serve custom HTML, views, and lightweight lookups. The implementations keep browser-side filtering, canvas edits, and PNG export out of server round-trips, and the paste service is about 200 lines including storage."
---

# How to build scalable web apps with OpenAI's Privacy Filter

[Hugging Face](https://yomu.fyi/company/hugging-face) · yuvraj sharma, Freddy Boulton, Abubakar Abid · Apr 27, 2026

**Type:** Tutorial

## Summary

The article presents three web applications built around OpenAI’s open-source Privacy Filter, a PII detector that labels eight categories in one forward pass over a 128k-token context. Document Privacy Explorer extracts PDF or DOCX text and returns category-labeled spans, while Image Anonymizer combines Tesseract word boxes with character offsets to produce editable pixel redaction rectangles. SmartRedact Paste replaces detected spans with category placeholders, stores public and token-gated views, and evicts expired pastes in a daemon thread. Across the apps, gradio.Server’s @server.api routes model work through Gradio’s queue and gradio\_client, while plain FastAPI routes serve custom HTML, views, and lightweight lookups. The implementations keep browser-side filtering, canvas edits, and PNG export out of server round-trips, and the paste service is about 200 lines including storage.

## Context

The applications address three explicit needs: reading PII-heavy documents with highlighted spans and category filters; sharing screenshots with adjustable black-bar redactions; and creating pastebin-style links that expose redacted text publicly while reserving the original for a token-gated reveal link.

## Approach / What changed

Privacy Filter processes document text, OCR-reconstructed image text, or pasted text in a single model call. The applications use gradio.Server’s @server.api for queued model operations and plain FastAPI routes for custom pages, views, and lightweight lookups. Browser code handles category toggles, canvas edits, PNG export, and rendering, while SmartRedact Paste stores redacted and original versions with generated identifiers and reveal tokens.

## Takeaways

- Privacy Filter has 1.5B parameters, 50M active parameters, an Apache 2.0 license, eight PII categories, and a 128,000-token context.
- @server.api connects model handlers to Gradio queueing, ZeroGPU composition, progress events, and gradio\_client access from both browser and Python clients.
- Image Anonymizer maps Privacy Filter’s character spans back to OCR word boxes, joins them into pixel rectangles, and keeps bar edits and PNG export in the browser.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Open Source](https://yomu.fyi/topic/open-source), [Performance](https://yomu.fyi/topic/performance), [Privacy](https://yomu.fyi/topic/privacy), [Python](https://yomu.fyi/topic/python)

- Source: [Hugging Face](https://huggingface.co/blog/openai-privacy-filter-web-apps)
- Source URL: https://huggingface.co/blog/openai-privacy-filter-web-apps
- Ingested by Yomu: 2026-08-29T01:48:21.374Z

[Read original post](https://huggingface.co/blog/openai-privacy-filter-web-apps)
