Three scripts and a matching test suite that let you experimentally
compare a fine-tuned model against the production gpt-5-nano baseline
on the same 10-record smoke eval.
* scripts/prep_ft_dataset.py β reads receipt/invoice JSONL and produces
OpenAI chat-completions fine-tuning format. System prompt matches
production (get_prompt(doc_type)); user shape matches
DocumentExtractor._build_messages; assistant carries the envelope
(data + field_confidences + warnings) with the ground truth as data.
Accepts multiple --input files (concatenated). --val-frac=0 skips the
validation split entirely for tiny datasets.
* scripts/launch_finetune.py β uploads train + val files via
files.create(purpose='fine-tune'), kicks off
fine_tuning.jobs.create() on gpt-4o-mini-2024-07-18 by default,
polls status every 30s. Ctrl-C detaches cleanly.
* scripts/compare_finetune.py β runs the 5-SROIE + 5-CORD smoke eval
against both the base model and the fine-tuned model, emits
comparison.mdβ¦
v3: streaming SSE + async batch API (12 new tests, 138 total)
- Rewrite the Extract button with explicit inline style so the coral CTA
reads clearly on cream (both enabled and disabled states now unambiguous).
- Rewrite DocTypePicker without the layoutId motion pill: simple bordered
toggles with clear active/inactive contrast, aria-pressed, and a
data-cursor='focus' hook.
- Add real sample assets: coffee_receipt.png and software_invoice.pdf.
- Harden loadSampleAsFile to reject text/html payloads (static hosts serve
index.html for 404s and it would silently poison /extract with an
unsupported_media_type).
fix(hf): trim short_description to fit 60-char cap + correct HF Space URLHF Spaces' pre-receive hook rejected the frontmatter because short_description was 86 chars (limit is 60). Trimmed to 49.Also swapped the HF Space URL from the GitHub username(adityapatel007-byte) to the correct HF handle (aditya0103) βbadge, live-demo section, and body prose all point at the right Space now.
deploy: HF Spaces β combined single-container imageWraps our existing 2-service compose into one image that HF Spaces' Docker SDK can run on its standard 7860 port.- Dockerfile (root): three-stage build1. node:20-alpine β npm ci + npm run build (produces ui/dist/)2. python:3.11-slim β pip install into an isolated /opt/venv3. python:3.11-slim + nginx (via apt) + tini as PID 1- docker/nginx.hf.conf: variant listening on 7860, proxies /api β 127.0.0.1:8000- docker/hf-entrypoint.sh: launches uvicorn in the background bound to127.0.0.1:8000 (nginx-only reachable), polls /health for up to 30s songinx isn't serving 502s during boot, then execs nginx in the foreground.Trap forwards SIGTERM to uvicorn for clean shutdown.- README.md: YAML frontmatter block (title, sdk: docker, app_port: 7860)that HF Spaces reads to configure the Space. Also added the π€ HF badgeand a 'Deploy your own' section for anyone forking.CI is unaffected β the existing docker/api.Dockerfile + docker/ui.Dockerfilestill drive the multi-container compose + CI docker-build job. This rootDockerfile is HF-only and doesn't touch the compose stack.
fix(ci): unblock UI job β anchor gitignore, include ui/src/libLast CI's Cannot find module @/lib/api (and @/lib/samples) turned outto be a gitignore over-match, not a tsconfig issue. .gitignore had barelib/ and lib64/ from its Python section β those aren't anchored, sothey silently matched ui/src/lib/ too, and neither api.ts nor samples.tsever made it into a commit. CI's fresh clone had an empty ui/src/lib/,tsc -b failed on the missing modules, docker-build gated behind and skipped.- .gitignore: anchor lib/ and lib64/ to repo root as /lib/, /lib64/- Force-add ui/src/lib/api.ts + ui/src/lib/samples.ts- Cascading fix: 'Parameter s implicitly has any' in Dropzone was because samples.ts couldn't resolve, so SampleDoc type didn't flow into the SAMPLE_DOCS.map callback. Present-again = inferred-again.