File size: 1,905 Bytes
4b3c0b4
9d84da3
 
4b3c0b4
9d84da3
4b3c0b4
9d84da3
4b3c0b4
 
 
9d84da3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
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.