Spaces:
Sleeping
Sleeping
Add app.py file
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
model_checkpoint = "vonewman/wolof-finetuned-ner"
|
6 |
+
|
7 |
+
ner_pipeline = pipeline("ner", model=model_checkpoint,
|
8 |
+
aggregation_strategy="simple")
|
9 |
+
|
10 |
+
examples = [
|
11 |
+
"Paap Juuf , politiseŋ bi Saa buñ nee Paap Juuf , xel yépp dem ci futbal ak Olympique de Marseille ",
|
12 |
+
"Bombardier xamle na ni dafa bëgga jàmmaarloo ak Eumeu Sen laata muy bàyyi.",
|
13 |
+
"Pastef benn kureel la ci Senegaal bu Ousmane Sonko jiite.",
|
14 |
+
"Waaye , li ëpp ci samay xalaat ak i seetlu , Afrig la ñeel , sunu Afrig ak ëllëgam"
|
15 |
+
]
|
16 |
+
|
17 |
+
def ner(text):
|
18 |
+
output = ner_pipeline(text)
|
19 |
+
return {"text": text, "entities": output}
|
20 |
+
|
21 |
+
demo = gr.Interface(ner,
|
22 |
+
gr.Textbox(placeholder="Tapez votre phrase ici..."),
|
23 |
+
gr.HighlightedText(),
|
24 |
+
examples=examples)
|
25 |
+
|
26 |
+
demo.launch(share=True)
|