import gradio as gr import bap_preprocessing import json def tokenize(Sentence): response = bap_preprocessing.tokenize(Sentence) result = json.dumps(response) return result with gr.Blocks() as demo: gr.Markdown( """ # Tokenizer """ ) input_s = gr.Textbox(placeholder="Sentence to be tokenized.", label="Sentence") output = gr.JSON(label="Tokens") submit = gr.Button(text="Tokenize") submit.click(fn=tokenize, inputs=input_s, outputs=output) examples = gr.Examples([ "Merhaba, ben okula gidiyorum.", "Rodin, Türkiye’de Düşünen Adam heykeliyle tanınır. Bir yandan da tartışmalı bir sanatçı." ], inputs=input_s) demo.launch()