Spaces:
Sleeping
Download README.md from joemartis/AccessibilityToolkit: direct link, hf CLI and curl.
- Browser
- Download file 6.49 kB
-
https://huggingface.co/spaces/joemartis/AccessibilityToolkit/resolve/main/README.md
- Command line
-
hf download hf://spaces/joemartis/AccessibilityToolkit/README.md
-
curl -L -o README.md https://huggingface.co/spaces/joemartis/AccessibilityToolkit/resolve/main/README.md
title: Accessibility Toolkit
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 8000
pinned: false
PPTX / PDF Accessibility Tools
Tools for remediating PowerPoint and PDF files (caps, language tags, math variables, reading order, footers, metadata, HTML export). Usable both as command-line scripts and through an internal web app.
The YAML block above configures a Hugging Face Space (Docker SDK, served on port 8000). See Deploy to Hugging Face Spaces below.
Web app
A FastAPI backend wraps each tool's existing core function (in tools/) and a
single-page frontend lets you upload a file, pick a tool, set options, and
download the result.
# Docker (recommended β bakes in QPDF for pikepdf):
docker compose up --build # then open http://localhost:8000
# Or run directly:
pip install -r requirements.txt
uvicorn backend.app.main:app --reload # then open http://localhost:8000
API: GET /api/tools (list + option schemas), POST /api/run/{tool}
(multipart upload + options β report and/or downloadable file), and
GET /api/result/{id} (download a produced file). Tools with a "Preview only"
option (PDF/PPTX language tags, footer removal) return a report without writing
a file. Uploads are written to a temp working dir and cleaned up after download
β originals are never modified.
Batch: upload multiple files in one run (the files field accepts many).
A single file returns that file; multiple files are processed independently and
returned as a zip, with a combined per-file report.
Upload limit: each file is capped (default 100 MB, set MAX_UPLOAD_MB to
change). Oversized uploads are rejected mid-stream with HTTP 413, so they never
fill the disk; the UI shows the limit and pre-checks before uploading.
Smoke tests
scripts/smoke_test.sh http://localhost:8000 # HTTP checks against a running server
scripts/docker_smoke.sh # build image, run container, smoke test, tear down
Deploy to Hugging Face Spaces
This repo is a ready-to-run Docker Space. The README.md YAML header sets
sdk: docker and app_port: 8000; the Dockerfile builds the FastAPI app
(with QPDF baked in) and serves the same web UI.
- Create a new Space: https://huggingface.co/new-space β SDK: Docker (blank template).
- Push this repository to the Space's git remote:
(Spaces build from thegit remote add space https://huggingface.co/spaces/<user>/<space-name> git push space <your-branch>:mainmainbranch.) - The Space builds the image and serves the app on port 8000 β open the Space URL and the tool UI loads.
Notes:
- No persistent storage is needed: uploads and results live in
/tmpand are cleaned up after download (and swept after an hour). - There's no auth β keep the Space private if the files aren't public. (A clean seam to add token/SSO auth later is described in the project notes.)
Automatic sync via GitHub Actions
.github/workflows/sync-to-hf.yml mirrors this repo to the Space on every push
to main (and on manual dispatch), so the live app rebuilds automatically.
Configure it once in the GitHub repo settings:
- Secret
HF_TOKENβ a Hugging Face access token with write scope (Settings β Access Tokens on huggingface.co). - Variable
HF_USERNAMEβ the Space owner (user or org). - Variable
HF_SPACEβ the Space name.
The workflow force-pushes the current ref to the Space's main, so the Space
stays an exact mirror. (Create the Space first, as above.)
Command-line setup (once)
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS / Linux: source .venv/bin/activate
pip install -r requirements.txt
Usage
One launcher drives everything. List the tools:
python run.py
Run a tool β anything after the name passes straight through to that script:
python run.py convert_caps deck.pptx --keep AI API
python run.py clear_pdf_metadata *.pdf
python run.py fix_pdf_lang_tags in.pdf out.pdf --to en-US
See a tool's own options:
python run.py convert_caps -h
You can still run any script directly (e.g. python tools/pptx/convert_caps.py ...);
the launcher is just a convenience so you don't have to remember paths.
Tools
PowerPoint (tools/pptx/)
| Name | What it does |
|---|---|
convert_caps |
All-caps / small-caps formatting β mixed case (batch + --keep acronyms; built-in list in tools/pptx/acronyms.txt) |
replace_allcaps_pptx |
Rewrites literal ALL-CAPS text to title/sentence case |
fix_math_italics |
Inline OMML math variables β plain italic runs (fixes screen-reader "equation" tags) |
fix_slide_number_order |
Moves slide-number placeholder last in reading order |
fix_pptx_lang_tags |
Sets every language attribute in the deck to a target language |
remove_footer_text |
Removes a specific string from slide/master/layout footers |
report_alt_text |
Reports each image's alt-text status (OK / weak / decorative / missing) β read-only |
check_slide_titles |
Reports slides with missing or duplicated titles β read-only |
check_hyperlinks |
Reports non-descriptive link text ("click here", bare URLs, empty) β read-only |
check_font_size |
Reports text runs below a minimum point size β read-only |
pptx_to_accessible_html |
Exports to accessible HTML (headings, alt text, notes, tables, MathJax) |
PDF (tools/pdf/)
| Name | What it does |
|---|---|
clear_pdf_metadata |
Strips title/author/subject/creator/producer metadata |
set_pdf_title |
Sets the document title and enables "Display document title" (PDF/UA) |
fix_pdf_lang_tags |
Rewrites /Lang entries throughout the file to a target language |
Notes
convert_capsis the batch-capable version (the older single-file variant was dropped).replace_allcaps_pptxis a separate tool: it changes the actual text, not just caps formatting.- Removed one duplicate copy of
clear_pdf_metadata.py. - Several tools default to overwriting in place or writing
<name>_mixed_case.pptxβ check each tool's-hbefore a batch run, and keep originals backed up.