BonusLockSMith's picture
Deploy structured-extractor (30-in-15 #4)
9d84da3 verified
|
Raw History Blame Contribute Delete
1.91 kB
---
title: Structured Data Extractor
emoji: 🧬
colorFrom: purple
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
---
# Structured Data Extractor 🧬
Paste messy, unstructured text — an email signature, a receipt, a job posting, an event
invite — and get back **clean, schema-valid JSON**. Pick a preset (Contact, Invoice,
Event, Job) or define your own fields.
> Project **#4** of my *"30 AI Projects in 15 Days"* build-in-public challenge.
**â–¶ Live demo: https://extract.gritai.solutions**
![demo](demo.png)
## What makes it reliable
The output is **always valid JSON matching the schema** — because it uses Claude's
**forced tool-use**: the model is required to call a tool whose `input_schema` *is* the
target schema, so the response is structured and validated at the API layer (no brittle
"parse JSON out of prose"). Missing fields come back as `null` — it never invents values.
(The local Ollama fallback uses constrained JSON decoding via `format=<schema>`.)
## What it demonstrates
- **Structured outputs / function-calling** — the core skill behind reliable AI pipelines.
- **Schema design** — presets plus on-the-fly custom field extraction.
- **Clean product UX** — one-click samples, syntax-highlighted JSON, copy to clipboard.
## Presets
👤 Contact · 🧾 Invoice/Receipt · 📅 Event · 💼 Job posting · ✨ Custom (your own fields)
## Run locally
```bash
pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-... # or set OLLAMA_URL / OLLAMA_MODEL
python app.py # http://127.0.0.1:8500
```
## Deploy (always-on)
Ships with a `Dockerfile` — works on **Hugging Face Spaces**, Render, Railway, or Fly.io.
Set `ANTHROPIC_API_KEY` (+ optional `ANTHROPIC_MODEL=claude-haiku-4-5`) as a secret.
---
Built by **Robert Lucyk** · [GritAI Solutions](https://gritai.solutions) · part of the 30-in-15 challenge.