Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from bs4 import BeautifulSoup
|
3 |
+
|
4 |
+
def html_to_text(html):
|
5 |
+
soup = BeautifulSoup(html, 'html.parser')
|
6 |
+
text = soup.get_text()
|
7 |
+
return text
|
8 |
+
|
9 |
+
iface = gr.Interface(
|
10 |
+
fn=html_to_text,
|
11 |
+
inputs=gr.Textbox(lines=15, label="输入HTML"),
|
12 |
+
outputs=gr.Textbox(label="文本输出"),
|
13 |
+
live=True
|
14 |
+
)
|
15 |
+
|
16 |
+
iface.launch()
|