File size: 427 Bytes
4a0869b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline
from normalizer import cleaning

pipe = pipeline("fill-mask", model="HooshvareLab/albert-fa-zwnj-base-v2")


def greet(text):
    text = cleaning(text)
    results = pipe(text)
    return results


demo = gr.Interface(fn=greet, inputs=gr.Textbox(label='input text'), outputs=gr.Textbox(label="Normalized text:"),
                    allow_flagging='never')


demo.launch()