Spaces:
Sleeping
Sleeping
metadata
title: RCA Judgment Validation
colorFrom: blue
colorTo: gray
sdk: docker
pinned: false
RCA judgment validation Label Studio Space
This Space runs Label Studio for human cross-validation of machine RCA labels on generated legal judgments.
Required Hugging Face setup
- Create the Space as a Docker Space.
- Attach a small persistent Storage Bucket mounted at
/data. - Add these Space secrets:
LABEL_STUDIO_USERNAME: admin emailLABEL_STUDIO_PASSWORD: admin passwordLABEL_STUDIO_USER_TOKEN: stable API token, at least 5 charactersSECRET_KEY: stable Django secret key, so sessions survive restarts
- Add these Space variables:
LABEL_STUDIO_BASE_DATA_DIR=/dataSTORAGE_PERSISTENCE=1LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN=trueLABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true
The bootstrap creates three projects with ten tasks each:
RCA Validation - Annotator 1RCA Validation - Annotator 2RCA Validation - Annotator 3
Each task shows the case metadata, generated/reference outcomes, model input case record, machine RCA, and generated/reference judgments side-by-side. Annotators answer:
- Rule stage
- Major error
- Minor error
Local data generation
From the repository root:
python3 label_studio_space/scripts/prepare_tasks.py
This regenerates:
label_studio_space/data/tasks_all.jsonlabel_studio_space/data/tasks_annotator_1.jsonlabel_studio_space/data/tasks_annotator_2.jsonlabel_studio_space/data/tasks_annotator_3.json
Export annotations
After annotation, use Label Studio's project export UI, or call:
curl -H "Authorization: Token $LABEL_STUDIO_USER_TOKEN" \
"$SPACE_URL/api/projects/<project_id>/export?exportType=JSON"
Programmatic HF provisioning
If huggingface_hub is installed and authenticated, provision the bucket mount, variables, secrets, and optional factory rebuild with:
python3 label_studio_space/scripts/provision_hf_space.py \
--space-id <namespace>/<space> \
--bucket-id <namespace>/label-studio-data \
--admin-email <admin@example.com> \
--admin-password <password> \
--admin-token <stable-token> \
--factory-reboot
To create/upload/provision/restart in one step:
python3 label_studio_space/scripts/deploy_hf_space.py \
--space-id <namespace>/<space> \
--bucket-id <namespace>/label-studio-data \
--admin-email <admin@example.com> \
--admin-password <password> \
--admin-token <stable-token>