SeyedAli commited on
Commit
fc8f9e3
β€’
1 Parent(s): 05b37bd

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from transformers import T5ForConditionalGeneration,AutoTokenizer,pipeline
4
+
5
+ tokenizer = AutoTokenizer.from_pretrained('SeyedAli/Persian-Text-paraphraser-mT5-V1',model_max_length=100, add_special_tokens = True)
6
+ model = T5ForConditionalGeneration.from_pretrained('SeyedAli/Persian-Text-paraphraser-mT5-V1')
7
+
8
+ def NER(text):
9
+ pipline = pipeline(task='text2text-generation', model=model, tokenizer=tokenizer)
10
+ output=pipline(text)
11
+ return output
12
+
13
+ iface = gr.Interface(fn=NER, inputs="text", outputs="text")
14
+ iface.launch(share=False)