1pip install olaverse[deeplearning]
2# installs: torch, transformers
1from olaverse import LIDNeural5
2
3# Automatically downloads and loads the model on demand
4detector = LIDNeural5()
5detector.load()
6
7# 1. Predict dominant language
8lang = detector.predict("Kedu ka ị mere today?")
9print(f"Predicted language: {lang}") # → 'ibo'
10
11# 2. Get probability distributions
12probs = detector.predict_proba("How far, wetin dey happen?")
13print(probs)
14# → {'eng': 0.002, 'hau': 0.001, 'ibo': 0.003, 'pcm': 0.991, 'yor': 0.003}
1from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
2
3tokenizer = AutoTokenizer.from_pretrained("olaverse/lid-neural-5")
4model = AutoModelForSequenceClassification.from_pretrained("olaverse/lid-neural-5")
5
6lid = pipeline("text-classification", model=model, tokenizer=tokenizer)
7result = lid("Bawo ni, se daadaa ni?")
8print(result) # → [{'label': 'yor', 'score': 0.9987}]