import gradio as gr from bs4 import BeautifulSoup def html_to_text(html): soup = BeautifulSoup(html, 'html.parser') text = soup.get_text() return text iface = gr.Interface( fn=html_to_text, inputs=gr.Textbox(lines=15, label="输入HTML"), outputs=gr.Textbox(label="文本输出"), live=True ) iface.launch()