|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
examples = [ |
|
["в 2006-2010 гг. Вася учился в МГУ"], |
|
["я купил iphone 10X за 14990 руб без 3х часов полдень и т.д."] |
|
] |
|
|
|
|
|
model = pipeline("text2text-generation", model="alexue4/text-normalization-ru-new") |
|
|
|
|
|
def normalize_text(input_text): |
|
return model(input_text, max_length=512)[0]['generated_text'] |
|
|
|
|
|
interface = gr.Interface( |
|
fn=normalize_text, |
|
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."), |
|
outputs=gr.Textbox(), |
|
examples=examples |
|
) |
|
|
|
|
|
interface.launch() |
|
|