|
import gradio as gr |
|
|
|
|
|
interface = gr.load("models/alexue4/text-normalization-ru-new") |
|
|
|
|
|
def custom_function(input_text): |
|
|
|
max_tokens = 250 |
|
if len(input_text.split()) > max_tokens: |
|
input_text = ' '.join(input_text.split()[:max_tokens]) |
|
|
|
|
|
original_output = interface.predict(input_text) |
|
return original_output |
|
|
|
examples = [ |
|
["в 2006-2010 гг. Вася учился в МГУ"], |
|
["я купил iphone 10X за 14990 руб без 3-x часов полдень и т.д."] |
|
] |
|
|
|
gr.Interface( |
|
fn=custom_function, |
|
inputs="text", |
|
outputs="text", |
|
examples=examples |
|
).launch() |
|
|
|
|
|
|