From 5254eb71c42580577b7caef636483b389b99233f Mon Sep 17 00:00:00 2001 From: Sa Phyo Thu Htet Date: Mon, 18 Sep 2023 22:44:13 +0630 Subject: [PATCH] Update utilities.py --- utilities.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/utilities.py b/utilities.py index 732c423..35e70ec 100644 --- a/utilities.py +++ b/utilities.py @@ -4,8 +4,26 @@ from tensorflow import keras from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences +from selenium import webdriver +from selenium.webdriver.chrome.options import Options +from selenium.webdriver.chrome.service import Service +from webdriver_manager.chrome import ChromeDriverManager import pickle +@st.cache_resource +def get_driver(): + options = Options() + options.add_argument('--disable-gpu') + options.add_argument('--headless') + return webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options) + + +def crawl(): + driver = get_driver() + driver.get("http://example.com") + st.code(driver.page_source) + + """" Tokenization """ def syllable_tokenization(input:str)->str: #input = re.sub(r"\s", "", input.strip()) @@ -137,12 +155,3 @@ def valid_parantheses(user_input): print(result) print()""" - - - - - - - - -