Views
No views yet
csebuetnlp/banglabert (Electra architecture)0 = Simple, 1 = Complex)BengaliReadability datasetLabel 1) to be sent to a Large Language Model (like Gemini) for simplification and syllable-scaffolding, while allowing simple sentences (Label 0) to pass through untouched.onnxruntime and HuggingFace's tokenizers:1import numpy as np
2from transformers import AutoTokenizer
3from optimum.onnxruntime import ORTModelForSequenceClassification
4
5# Load tokenizer and ONNX model
6tokenizer = AutoTokenizer.from_pretrained("YOUR_USERNAME/banglabert-sentence-router-onnx")
7model = ORTModelForSequenceClassification.from_pretrained("YOUR_USERNAME/banglabert-sentence-router-onnx")
8
9text = "বাংলাদেশের অর্থনীতি মূলত কৃষিনির্ভর।"
10inputs = tokenizer(text, return_tensors="pt")
11
12# Inference
13outputs = model(**inputs)
14logits = outputs.logits.detach().numpy()
15predicted_class = np.argmax(logits, axis=1)[0]
16confidence = np.max(np.exp(logits) / np.sum(np.exp(logits), axis=1, keepdims=True))
17
18print("Class:", "Complex" if predicted_class == 1 else "Simple")
19print("Confidence:", confidence)