import gradio as gr from inference_services import InferencePipe # Assuming your script is saved as inference_pipe.py # Instantiate the pipeline pipe = InferencePipe() # Gradio interface function def punctuate_text(text: str, confidence_threshold: float = 0.7) -> str: return pipe.punctuate(text, conf_thresh=confidence_threshold) # Gradio interface with gr.Blocks() as demo: gr.Markdown("# Verbex Punctuation Restoration") gr.Markdown("Restore punctuation in raw, unpunctuated text using a token classification model.") with gr.Row(): input_text = gr.Textbox( label="Input Text", placeholder="enter text without punctuation here", lines=6 ) output_text = gr.Textbox( label="Punctuated Output", lines=6, interactive=False ) conf_slider = gr.Slider(0.0, 1.0, value=0.7, step=0.01, label="Confidence Threshold") run_btn = gr.Button("Restore Punctuation") run_btn.click(fn=punctuate_text, inputs=[input_text, conf_slider], outputs=output_text) demo.launch(share = True)