Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from selenium.common.exceptions import WebDriverException
|
|
4 |
from PIL import Image
|
5 |
from io import BytesIO
|
6 |
|
7 |
-
def
|
8 |
options = webdriver.ChromeOptions()
|
9 |
options.add_argument('--headless')
|
10 |
options.add_argument('--no-sandbox')
|
@@ -27,11 +27,12 @@ def take_screenshot(url):
|
|
27 |
return Image.open(BytesIO(screenshot))
|
28 |
|
29 |
iface = gr.Interface(
|
30 |
-
fn=
|
31 |
-
inputs=gr.inputs.Textbox(label="Website URL", default="https://
|
32 |
-
outputs=gr.
|
33 |
-
title="
|
34 |
-
description="
|
35 |
)
|
36 |
|
|
|
37 |
iface.launch()
|
|
|
4 |
from PIL import Image
|
5 |
from io import BytesIO
|
6 |
|
7 |
+
def web_scrape(url):
|
8 |
options = webdriver.ChromeOptions()
|
9 |
options.add_argument('--headless')
|
10 |
options.add_argument('--no-sandbox')
|
|
|
27 |
return Image.open(BytesIO(screenshot))
|
28 |
|
29 |
iface = gr.Interface(
|
30 |
+
fn=web_scrape,
|
31 |
+
inputs=gr.inputs.Textbox(label="Website URL", default="https://example.com"),
|
32 |
+
outputs=gr.outputs.Textbox(label="Web Content"),
|
33 |
+
title="Web Scraping with Selenium (Body Tag)",
|
34 |
+
description="Scrape the content of a website's <body> tag using Selenium.",
|
35 |
)
|
36 |
|
37 |
+
|
38 |
iface.launch()
|