Text Classification
Transformers
Safetensors
English
Ukrainian
qwen3_5
image-text-to-text
openjudgement
judgment
classification
structured-output
preview
custom-code
Instructions to use kitaniai/OpenJudgement-4B-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kitaniai/OpenJudgement-4B-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="kitaniai/OpenJudgement-4B-Preview")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("kitaniai/OpenJudgement-4B-Preview") model = AutoModelForMultimodalLM.from_pretrained("kitaniai/OpenJudgement-4B-Preview", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download tests/test_api.py from kitaniai/OpenJudgement-4B-Preview: direct link, hf CLI and curl.
- Browser
- Download file 1.72 kB
-
https://huggingface.co/kitaniai/OpenJudgement-4B-Preview/resolve/main/tests/test_api.py
- Command line
-
hf download hf://kitaniai/OpenJudgement-4B-Preview/tests/test_api.py
-
curl -L -o test_api.py https://huggingface.co/kitaniai/OpenJudgement-4B-Preview/resolve/main/tests/test_api.py
1.72 kB
| from fastapi.testclient import TestClient | |
| from serve import create_app | |
| class FakeJudge: | |
| model_name = 'test-preview' | |
| def system_one(self, state, questions): | |
| if state == 'invalid': | |
| raise ValueError('Input exceeds configured context; nothing was truncated.') | |
| return {'model': self.model_name, 'answers': {key: {'type': 'noul', 'noul': 0.75} for key in questions}} | |
| def test_api_request_and_health(): | |
| with TestClient(create_app(loader=FakeJudge)) as client: | |
| assert client.get('/health').json()['ready'] is True | |
| response = client.post('/v1/judgments', json={'state': 'Evidence.', 'questions': {'q': {'type': 'noul', 'instructions': 'Supported?'}}}) | |
| assert response.status_code == 200 | |
| assert response.json()['answers']['q']['noul'] == 0.75 | |
| assert response.json()['timing']['inference_ms'] >= 0 | |
| def test_api_rejects_bad_requests_without_inference(): | |
| with TestClient(create_app(loader=FakeJudge)) as client: | |
| assert client.post('/v1/judgments', json={'state': 'Evidence.', 'questions': {}}).status_code == 422 | |
| assert client.post('/v1/judgments', json={'state': 'invalid', 'questions': {'q': {}}}).status_code == 422 | |
| def test_examples_follow_native_contract(): | |
| import json | |
| from pathlib import Path | |
| from core import normalize_question | |
| request = json.loads((Path(__file__).resolve().parents[1]/'examples/request.json').read_text()) | |
| assert {q['type'] for q in request['questions'].values()} == {'noul','choice','score'} | |
| for question in request['questions'].values(): | |
| kind,instructions,candidates,keys = normalize_question(question) | |
| assert instructions and len(candidates) == len(keys) | |