Spaces:
Sleeping
Sleeping
File size: 689 Bytes
b874025 a94879a b874025 0606278 0c1764c b874025 378ee8a a94879a b874025 a94879a 378ee8a 0606278 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
import requests
from selectolax.parser import HTMLParser
import pyperclip
def get_web_page_data(url):
response = requests.get(url)
parser = HTMLParser(html=response.text)
return parser.html
def copy_to_clipboard(text):
pyperclip.copy(text)
return "Copied to clipboard!"
with gr.Blocks() as demo:
url_input = gr.Textbox(label="Enter a URL")
output = gr.Textbox(label="Web Page Data")
copy_output = gr.Textbox(label="Copy Status")
gr.Button("Get Web Page Data").click(get_web_page_data, inputs=url_input, outputs=output)
gr.Button("Copy to Clipboard").click(copy_to_clipboard, inputs=output, outputs=copy_output)
demo.launch() |