custom_toolbox / apps /text_tools.py
MashiroLn's picture
Upload folder using huggingface_hub
b44ae07 verified
raw
history blame
418 Bytes
import gradio as gr
def analyze_text(text):
return {
"字符数": len(text),
"单词数 (空格分隔)": len(text.split()),
"行数": len(text.splitlines())
}
def create_ui():
with gr.Row():
inp = gr.Textbox(lines=5, label="输入文本")
out = gr.JSON(label="统计结果")
btn = gr.Button("分析")
btn.click(analyze_text, inp, out)