mrfakename's picture
Update app.py
3de8d64 verified
raw
history blame contribute delete
747 Bytes
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)