Ner-Demi / app.py
OnurDemircioglu's picture
Upload app.py
7b4090b verified
raw
history blame contribute delete
840 Bytes
# -*- coding: utf-8 -*-
"""NlpProgramı.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1lq4Js56nOdwQFI7g4I-s8zkPP_5leQpG
"""
#!pip install -q transformers
from transformers import pipeline
ner_pipeline = pipeline('ner', model='Tirendaz/roberta-base-NER')
text = "Ben Onur ve ben Google'da çalışıyorum"
ner_pipeline(text, aggregation_strategy = "simple")
def ner(text):
output = ner_pipeline(text, aggregation_strategy = "simple")
return {"text": text,"entities":output}
#!pip install -q gradio
import gradio as gr
examples = [
"Ben Ali ve ben Google'da çalışıyorum",
"My name is Tim and I live in California",
]
demo = gr.Interface(ner, gr.Textbox(placeholder="Metni Giriniz..."), gr.HighlightedText(),examples=examples)
demo.launch(share=True)