import gradio as gr from selenium import webdriver from selenium.common.exceptions import WebDriverException from selenium.webdriver.common.by import By resp="" def take_screenshot(url): options = webdriver.ChromeOptions() options.add_argument('--headless') #options.add_argument('--no-sandbox') #options.add_argument('--disable-dev-shm-usage') wd = webdriver.Chrome(options=options) wd.get(url) wd.implicitly_wait(7) #element=wd.find_element(By.TAG_NAME, "body") button_send = driver.find_element(By.ID, "L2AGLb").click() element=wd.find_element(By.TAG_NAME, "body") return element.text iface = gr.Interface( fn=take_screenshot, inputs=gr.Textbox(label="Website URL", value="https://spiegel.de"), outputs=gr.Textbox(), title="Website Screenshot", description="Take a screenshot of a website." ) iface.launch()