Download app.py from chamemaru/bert-base-NER_FORMEEE: direct link, hf CLI and curl.
- Browser
- Download file 620 Bytes
-
https://huggingface.co/chamemaru/bert-base-NER_FORMEEE/resolve/main/app.py
- Command line
-
hf download hf://chamemaru/bert-base-NER_FORMEEE/app.py
-
curl -L -o app.py https://huggingface.co/chamemaru/bert-base-NER_FORMEEE/resolve/main/app.py
620 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| ner_pipeline = pipeline("ner", model="dslim/bert-base-NER", grouped_entities=True) | |
| def highlight_entities(text): | |
| entities = ner_pipeline(text) | |
| # Gradio มีระบบ Highlight ข้อความให้อัตโนมัติถ้าเราส่งค่าไปแบบนี้ | |
| return {"text": text, "entities": entities} | |
| demo = gr.Interface( | |
| fn=highlight_entities, | |
| inputs=gr.Textbox(placeholder="Enter sentence here..."), | |
| outputs=gr.HighlightedText(), | |
| title="Name Entity Recognition (NER) Finder" | |
| ) | |
| demo.launch() |