Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,12 +7,23 @@ def get_web_page_data(url):
|
|
| 7 |
parser = HTMLParser(html=response.text)
|
| 8 |
return parser.html
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
demo = gr.Interface(
|
| 11 |
fn=get_web_page_data,
|
| 12 |
inputs="text",
|
| 13 |
-
outputs="text",
|
| 14 |
title="Web Page Data Extractor",
|
| 15 |
description="Enter a URL to extract its web page data"
|
| 16 |
)
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
demo.launch()
|
|
|
|
| 7 |
parser = HTMLParser(html=response.text)
|
| 8 |
return parser.html
|
| 9 |
|
| 10 |
+
def copy_to_clipboard(text):
|
| 11 |
+
import pyperclip
|
| 12 |
+
pyperclip.copy(text)
|
| 13 |
+
return "Copied to clipboard!"
|
| 14 |
+
|
| 15 |
demo = gr.Interface(
|
| 16 |
fn=get_web_page_data,
|
| 17 |
inputs="text",
|
| 18 |
+
outputs=["text", "button"],
|
| 19 |
title="Web Page Data Extractor",
|
| 20 |
description="Enter a URL to extract its web page data"
|
| 21 |
)
|
| 22 |
|
| 23 |
+
demo.add_component(
|
| 24 |
+
gr.Button(value="Copy to Clipboard", click_fn=copy_to_clipboard),
|
| 25 |
+
inputs=["text"],
|
| 26 |
+
outputs=["text"]
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
demo.launch()
|