wiraindrak's picture
Create new file
2168cf5
raw
history blame
548 Bytes
from transformers import pipeline
import gradio as gr
pretrained_name = "cahya/bert-base-indonesian-NER"
ner = pipeline(
"ner",
model=pretrained_name,
tokenizer=pretrained_name
)
examples = [
"Ada apa dengan Jokowi di istana negara?",
]
def ner(text):
output = ner(text)
return {"text": text, "entities": output}
demo = gr.Interface(ner,
gr.Textbox(placeholder="Enter sentence here..."),
gr.HighlightedText(),
examples=examples)
if __name__ == "__main__":
demo.launch()