File size: 853 Bytes
0212cf8
 
 
 
f5a2147
0212cf8
a0808e1
 
0212cf8
 
 
60235aa
0212cf8
657aebe
0212cf8
 
 
 
 
 
 
 
 
 
 
 
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
from transformers import pipeline
import gradio as gr


model_checkpoint = "vonewman/xlm-roberta-base-finetuned-wolof"

ner_pipeline = pipeline("ner", model=model_checkpoint, 
                        aggregation_strategy="simple")  

examples = [
    "Paap  Juuf  , politiseŋ bi Saa buñ nee Paap  Juuf  , xel yépp dem ci futbal ak Olympique de Marseille ",
    "Xamal ni bëgg naa la ba fàww te dootuma la fàtte ",
    "Pastef benn kureel la ci Senegaal bu Ousmane Sonko jiite.",
    "Màkki Sàll feeñal na ay xalaatam ci mbir yu am solo yu soxal Senegal ak Afrik."
]

def ner(text):
    output = ner_pipeline(text)
    return {"text": text, "entities": output}

demo = gr.Interface(ner,
             gr.Textbox(placeholder="Tapez votre phrase ici..."),
             gr.HighlightedText(),
             examples=examples)

demo.launch(share=True)