Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from selenium.common.exceptions import WebDriverException
|
|
4 |
from selenium.webdriver.common.by import By
|
5 |
|
6 |
|
7 |
-
def take_screenshots(start, end, step):
|
8 |
options = webdriver.ChromeOptions()
|
9 |
options.add_argument('--headless')
|
10 |
wd = webdriver.Chrome(options=options)
|
@@ -12,7 +12,7 @@ def take_screenshots(start, end, step):
|
|
12 |
results = []
|
13 |
|
14 |
for i in range(start, end + 1, step):
|
15 |
-
url = f"https://www.google.com/search?q=vereine+
|
16 |
wd.get(url)
|
17 |
wd.implicitly_wait(3)
|
18 |
|
@@ -30,13 +30,14 @@ def take_screenshots(start, end, step):
|
|
30 |
iface = gr.Interface(
|
31 |
fn=take_screenshots,
|
32 |
inputs=[
|
|
|
33 |
gr.Number(label="Start Index", value=10),
|
34 |
gr.Number(label="End Index", value=100),
|
35 |
gr.Number(label="Step Size", value=10)
|
36 |
],
|
37 |
outputs=gr.Textbox(),
|
38 |
title="Website Screenshot",
|
39 |
-
description="Take screenshots of websites in specified range and step size."
|
40 |
)
|
41 |
|
42 |
iface.launch()
|
|
|
4 |
from selenium.webdriver.common.by import By
|
5 |
|
6 |
|
7 |
+
def take_screenshots(ort, start, end, step):
|
8 |
options = webdriver.ChromeOptions()
|
9 |
options.add_argument('--headless')
|
10 |
wd = webdriver.Chrome(options=options)
|
|
|
12 |
results = []
|
13 |
|
14 |
for i in range(start, end + 1, step):
|
15 |
+
url = f"https://www.google.com/search?q=vereine+{ort}&start={i}"
|
16 |
wd.get(url)
|
17 |
wd.implicitly_wait(3)
|
18 |
|
|
|
30 |
iface = gr.Interface(
|
31 |
fn=take_screenshots,
|
32 |
inputs=[
|
33 |
+
gr.Textbox(label="Ort", value="Bamberg"),
|
34 |
gr.Number(label="Start Index", value=10),
|
35 |
gr.Number(label="End Index", value=100),
|
36 |
gr.Number(label="Step Size", value=10)
|
37 |
],
|
38 |
outputs=gr.Textbox(),
|
39 |
title="Website Screenshot",
|
40 |
+
description="Take screenshots of websites in specified range and step size for a given location."
|
41 |
)
|
42 |
|
43 |
iface.launch()
|