File size: 566 Bytes
72faba1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
764740b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from transformers import pipeline

import gradio as gr

ner_pipeline = pipeline("ner", model = "Tirendaz/roberta-base-NER")

examples = [
    "My name is Tim and I live in California.",
    "Ich arbeite bei Google in Berlin",
    "Ali, Ankara'lı mı?"
]

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

demo = gr.Interface(ner,
             gr.Textbox(placeholder="Enter sentence here..."), 
             gr.HighlightedText(),
             examples=examples)

demo.launch(share=True)