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)