Instructions to use CaseLoop/rights-navigator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CaseLoop/rights-navigator with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("CaseLoop/rights-navigator") model = AutoModelForSeq2SeqLM.from_pretrained("CaseLoop/rights-navigator", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,573 Bytes
50a8ea3 | 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 | import sys
from pathlib import Path
# Ensure the root directory is on the path so module imports work correctly
root_dir = Path(__file__).resolve().parent.parent
if str(root_dir) not in sys.path:
sys.path.append(str(root_dir))
from rti_formatter_module.generator import generate_rti_draft
def test_formatter():
test_cases = [
(
"Road Infrastructure",
"There are massive potholes on MG Road near the metro station causing traffic jams and accidents since last month. No repairs have been done."
),
(
"Water Supply Issue",
"Water supply has been completely cut off in Sector 4 residential area for the past 4 days without prior notice from the municipal corporation."
),
(
"Garbage Disposal",
"Sanitation workers have not collected garbage from Ward 12 for two weeks, creating illegal open dumping sites near the school."
)
]
print("=" * 60)
print("RUNNING RTI FORMATTER TEST SUITE")
print("=" * 60)
for idx, (category, grievance) in enumerate(test_cases, 1):
print(f"\n[Test Case {idx}] Category: {category}")
print(f"Input Grievance: {grievance}\n")
try:
draft = generate_rti_draft(grievance)
print("--- Output RTI Draft ---")
print(draft)
except Exception as e:
print(f"Error during generation: {e}")
print("-" * 60)
if __name__ == "__main__":
test_formatter() |