|
import gradio as gr |
|
from deepmultilingualpunctuation import PunctuationModel |
|
|
|
def punctuate_text(input_text): |
|
|
|
model = PunctuationModel('ModelsLab/punctuate-indic-v1') |
|
|
|
result = model.restore_punctuation(input_text) |
|
return result |
|
|
|
|
|
def main(): |
|
with gr.Blocks() as interface: |
|
gr.Markdown("""# Punctuation Restorer for Indic Languages |
|
Enter your unpunctuated text in the box below, and this tool will restore punctuation for better readability. |
|
""") |
|
|
|
|
|
input_text = gr.Textbox(label="Enter your text", placeholder="Type your unpunctuated text here...") |
|
|
|
|
|
output_text = gr.Textbox(label="Punctuated Text", interactive=False) |
|
|
|
|
|
submit_button = gr.Button("Punctuate Text") |
|
|
|
|
|
submit_button.click(fn=punctuate_text, inputs=input_text, outputs=output_text) |
|
|
|
interface.launch() |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|