import gradio as gr | |
import hashlib | |
def fx(x:str): | |
hash=hashlib.md5() | |
hash.update(x.encode(encoding='utf-8')) | |
return hash.hexdigest() | |
demo=gr.Blocks() | |
with demo: | |
text_input=gr.Textbox(placeholder='请输入测试字符串',label="请输入需要MD5加密的测试内容") | |
bb_button=gr.Button("运行") | |
bb_button.click(fx, inputs=text_input, outputs=gr.Textbox(label="输出"),api_name='md5') | |
demo.launch() | |