SeyedAli's picture
Update app.py
a93df86
raw
history blame contribute delete
548 Bytes
import gradio as gr
import torch
from transformers import AutoModelForTokenClassification,AutoTokenizer,pipeline
model = AutoModelForTokenClassification.from_pretrained('SeyedAli/Persian-Text-NER-Bert-V1')
tokenizer = AutoTokenizer.from_pretrained('SeyedAli/Persian-Text-NER-Bert-V1')
def NER(text):
pipline = pipeline(task="token-classification", model=model, tokenizer=tokenizer, aggregation_strategy="simple")
output=pipline(text)
return output
iface = gr.Interface(fn=NER, inputs="text", outputs="text")
iface.launch(share=False)