File size: 747 Bytes
fe0a882 da5e1f3 fe0a882 3de8d64 da5e1f3 fe0a882 1c82317 da5e1f3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from deepmultilingualpunctuation import PunctuationModel
import gradio as gr
model = PunctuationModel()
def run(t):
if len(t) > 1000:
raise gr.Error("Max text length is 1000")
return model.restore_punctuation(t)
with gr.Blocks() as demo:
gr.Markdown("# Restore Punctuation\n\nWith [Deep Multilingual Punctuation](https://github.com/oliverguhr/fullstop-deep-punctuation-prediction).")
t = gr.Textbox(label="Text (max len 1000)", placeholder="Enter text here, supported languages are English, Italian, French, and German")
o = gr.Textbox(label="Output", interactive=False)
b = gr.Button("Restore")
b.click(run, inputs=t, outputs=o)
demo.queue(api_open=False, default_concurrency_limit=20).launch(show_api=False) |