flatindo commited on
Commit
850d477
·
1 Parent(s): ecabf86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
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 take_screenshot(url):
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=take_screenshot,
31
- inputs=gr.inputs.Textbox(label="Website URL", default="https://google.com"),
32
- outputs=gr.Image(type="pil", height=360, width=540), # Adjust the image size here
33
- title="Website Scrape",
34
- description="Take data a website.",
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()