Spaces:
Runtime error
Runtime error
max-unfinity
commited on
Commit
·
5cec537
1
Parent(s):
aca6818
fix cache
Browse files- .gitignore +1 -0
- .vscode/launch.json +22 -0
- app.py +4 -3
- selenium_parser.py +1 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
__pycache__
|
.vscode/launch.json
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
// Use IntelliSense to learn about possible attributes.
|
3 |
+
// Hover to view descriptions of existing attributes.
|
4 |
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5 |
+
"version": "0.2.0",
|
6 |
+
"configurations": [
|
7 |
+
{
|
8 |
+
"name": "Streamlit",
|
9 |
+
"type": "python",
|
10 |
+
"request": "launch",
|
11 |
+
"module": "streamlit",
|
12 |
+
"console": "integratedTerminal",
|
13 |
+
"args": [
|
14 |
+
"run",
|
15 |
+
"app.py"
|
16 |
+
],
|
17 |
+
"env": {
|
18 |
+
"STREAMLIT_SERVER_PORT": "8501"
|
19 |
+
},
|
20 |
+
}
|
21 |
+
]
|
22 |
+
}
|
app.py
CHANGED
@@ -3,8 +3,9 @@ from selenium_parser import load_driver
|
|
3 |
import streamlit as st
|
4 |
|
5 |
|
6 |
-
@st.
|
7 |
def init():
|
|
|
8 |
init_env()
|
9 |
|
10 |
|
@@ -14,12 +15,12 @@ def get_driver():
|
|
14 |
|
15 |
|
16 |
def run():
|
|
|
17 |
driver.get("https://www.booking.com/hotel/th/queen-boutique.ru.html#tab-reviews")
|
18 |
-
st.write("
|
19 |
st.image(driver.get_screenshot_as_png(), caption="screenshot")
|
20 |
|
21 |
|
22 |
init()
|
23 |
-
driver = get_driver()
|
24 |
|
25 |
st.button("Run", on_click=run)
|
|
|
3 |
import streamlit as st
|
4 |
|
5 |
|
6 |
+
@st.cache_data
|
7 |
def init():
|
8 |
+
# print("init")
|
9 |
init_env()
|
10 |
|
11 |
|
|
|
15 |
|
16 |
|
17 |
def run():
|
18 |
+
driver = get_driver()
|
19 |
driver.get("https://www.booking.com/hotel/th/queen-boutique.ru.html#tab-reviews")
|
20 |
+
st.write("Page loaded:")
|
21 |
st.image(driver.get_screenshot_as_png(), caption="screenshot")
|
22 |
|
23 |
|
24 |
init()
|
|
|
25 |
|
26 |
st.button("Run", on_click=run)
|
selenium_parser.py
CHANGED
@@ -13,6 +13,7 @@ def load_driver():
|
|
13 |
opts = FirefoxOptions()
|
14 |
opts.add_argument("--headless")
|
15 |
driver = webdriver.Firefox(options=opts)
|
|
|
16 |
return driver
|
17 |
|
18 |
|
|
|
13 |
opts = FirefoxOptions()
|
14 |
opts.add_argument("--headless")
|
15 |
driver = webdriver.Firefox(options=opts)
|
16 |
+
print("OK.")
|
17 |
return driver
|
18 |
|
19 |
|