lang-detect / README.md
emanuelaboros's picture
Update README.md
f4c750f verified
metadata
library_name: transformers
language:
  - en
  - fr
  - de
tags:
  - v1.0.0

How to use

You can use this model with Transformers pipeline for NER.

from transformers import pipeline

MODEL_NAME = "emanuelaboros/lang-detect"

lang_pipeline = pipeline("lang-detect", model=MODEL_NAME, 
                        trust_remote_code=True,
                        device='cpu')

sentence = """En l'an 1348, au plus fort des ravages de la peste noire à travers l'Europe,
          le Royaume de France se trouvait à la fois au bord du désespoir et face à une opportunité."""

langs = lang_pipeline(sentence)
langs
{'label': 'fr', 'confidence': 99.87}

Works with lists of sentences also.

BibTeX entry and citation info