metadata
license: eupl-1.1
language:
- el
library_name: fasttext
pipeline_tag: text-classification
ilsp/justice
repo_id = "ilsp/justice"
model_path = hf_hub_download(repo_id=repo_id, filename="20241124-model.ftz")
sample_decision = hf_hub_download(repo_id=repo_id, filename="sample_data/Α2485_2023.txt")
model = load_model(model_path)
labels_map = {
'preamble': '__label__0', '__label__0': 'preamble',
'panel': '__label__1', '__label__1': 'panel',
'litigants': '__label__2', '__label__2': 'litigants',
'justification': '__label__3', '__label__3': 'justification',
'decision': '__label__4', '__label__4': 'decision',
'post': '__label__5', '__label__5': 'post'}
with open(sample_decision) as inf:
paras = [p for p in inf.read().split(NL) if p.strip()]
random.shuffle(paras)
text = NL.join(paras)
nchars = 150
for line in text.split(NL):
pred = labels_map[model.predict(line.strip())[0][0]]
if len(line) > nchars:
line = line[0:nchars]
print(f"{line} -> {pred}")