File size: 1,759 Bytes
0675e3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ClaimCheck — Python implementation

The reference implementation. Same rules as the JavaScript port that powers the
[Space](https://huggingface.co/spaces/NagaYu/ClaimCheck), verified at **100% behavioural parity**
across all 158 cases of [`NagaYu/claimcheck-eval`](https://huggingface.co/datasets/NagaYu/claimcheck-eval).

Use this when you want a **server-side API** rather than a browser page: a Gradio UI with seven REST
endpoints, an in-memory observability dashboard (per-model/per-prompt-version comparison, latency
percentiles, savings), and a false-positive audit tab.

```bash
pip install -r requirements.txt
python app.py          # http://127.0.0.1:7860
```

```python
from gradio_client import Client
client = Client("http://127.0.0.1:7860/")
result, highlighted, summary = client.predict(
    answer="Operating margin was 15%.",
    context="Revenue was 12,000 million and operating profit 1,800 million.",
    system_prompt="", user_input="", schema_json="",
    policy_json='{"enable_entity": false}',
    tags_json='{"model": "my-model", "prompt_version": "v1"}',
    api_name="/verify",
)
print(result["verdict"], result["grounding_score"], result["coverage"])
```

Endpoints: `/verify`, `/retry_advice`, `/stats`, `/structure`, `/health`, `/audit_refresh`, `/audit_mark`.

`deploy.md` is a step-by-step deployment guide (in Japanese) including a staged rollout plan.

> **Note on Hugging Face Spaces:** Gradio Spaces now require a PRO subscription on `cpu-basic`.
> Only static Spaces are free, which is why the hosted demo is the JavaScript port. This Python
> version is for self-hosting anywhere you like.

Verification itself uses **only the standard library** — `gradio` and `pandas` are for the UI and the
dashboard. Apache-2.0.