Spaces:
Sleeping
Sleeping
# -*- coding: utf-8 -*- | |
""" | |
Created on Thu Aug 8 15:10:36 2024 | |
@author: Ali PAK | |
""" | |
#pip install numpy | |
from transformers import pipeline | |
import gradio as gr | |
import torch | |
ner_pipeline=pipeline("ner",model="apak/bert-base-uncased-for-ner") | |
def ner(text): | |
output=ner_pipeline(text,aggregation_strategy="simple") | |
return {"text":text, "entities": output} | |
examples=[ | |
" My name is Jessica, I work at Google", | |
" Arsenal won the FA Cup.", | |
" Rashid played for Galatasaray Istanbul." | |
] | |
demo=gr.Interface( | |
ner, | |
gr.Textbox(placeholder="Enter sentence here..."), | |
gr.HighlightedText(), | |
examples=examples | |
) | |
demo.launch(share=True) |