File size: 548 Bytes
a93df86
4c7eeb3
 
 
66183df
 
4c7eeb3
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)