Text Classification
Transformers
English
Japanese
hallucination-detection
groundedness
rag
guardrails
rule-based
not-a-neural-model
Instructions to use NagaYu/claimcheck-rules with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NagaYu/claimcheck-rules with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="NagaYu/claimcheck-rules")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("NagaYu/claimcheck-rules", device_map="auto") - Notebooks
- Google Colab
- Kaggle
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.
|