File size: 339 Bytes
7bd0514
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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()