Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -305,37 +305,70 @@ def display_about_page():
|
|
| 305 |
<img src="https://content.linkedin.com/content/dam/me/business/en-us/amp/brand-site/v2/bg/LI-Logo.svg.original.svg" width="100">
|
| 306 |
</a>
|
| 307 |
""", unsafe_allow_html=True)
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
|
| 315 |
-
|
| 316 |
def main():
|
| 317 |
st.title("Job Easz")
|
| 318 |
-
|
|
|
|
| 319 |
df = load_and_concat_data()
|
| 320 |
-
|
| 321 |
if df.empty:
|
| 322 |
st.error("No data available. Please check your dataset.")
|
| 323 |
return
|
| 324 |
|
| 325 |
# Sidebar for navigation
|
| 326 |
st.sidebar.title("Navigation")
|
| 327 |
-
page = st.sidebar.radio("Go to", ["Dashboard", "Data Explorer","About"])
|
| 328 |
|
|
|
|
| 329 |
if page == "Dashboard":
|
| 330 |
display_dashboard(df)
|
| 331 |
elif page == "Data Explorer":
|
| 332 |
display_data_explorer(df)
|
| 333 |
elif page == "About":
|
| 334 |
display_about_page()
|
| 335 |
-
elif page==
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
|
| 340 |
|
| 341 |
if __name__ == "__main__":
|
|
|
|
| 305 |
<img src="https://content.linkedin.com/content/dam/me/business/en-us/amp/brand-site/v2/bg/LI-Logo.svg.original.svg" width="100">
|
| 306 |
</a>
|
| 307 |
""", unsafe_allow_html=True)
|
| 308 |
+
import hmac
|
| 309 |
+
|
| 310 |
+
def check_password():
|
| 311 |
+
"""Returns `True` if the user entered a correct password."""
|
| 312 |
+
|
| 313 |
+
def login_form():
|
| 314 |
+
"""Form with widgets to collect user information."""
|
| 315 |
+
with st.form("Credentials"):
|
| 316 |
+
st.text_input("Username", key="username")
|
| 317 |
+
st.text_input("Password", type="password", key="password")
|
| 318 |
+
st.form_submit_button("Log in", on_click=password_entered)
|
| 319 |
+
|
| 320 |
+
def password_entered():
|
| 321 |
+
"""Checks whether a password entered by the user is correct."""
|
| 322 |
+
if st.session_state["username"] in st.secrets[
|
| 323 |
+
"passwords"
|
| 324 |
+
] and hmac.compare_digest(
|
| 325 |
+
st.session_state["password"],
|
| 326 |
+
st.secrets.passwords[st.session_state["username"]],
|
| 327 |
+
):
|
| 328 |
+
st.session_state["password_correct"] = True
|
| 329 |
+
del st.session_state["password"] # Don't store username or password.
|
| 330 |
+
del st.session_state["username"]
|
| 331 |
+
else:
|
| 332 |
+
st.session_state["password_correct"] = False
|
| 333 |
+
|
| 334 |
+
# Return True if the username + password is validated.
|
| 335 |
+
if st.session_state.get("password_correct", False):
|
| 336 |
+
return True
|
| 337 |
+
|
| 338 |
+
# Show inputs for username + password.
|
| 339 |
+
login_form()
|
| 340 |
+
if "password_correct" in st.session_state:
|
| 341 |
+
st.error("😕 User not known or password incorrect")
|
| 342 |
+
return False
|
| 343 |
|
|
|
|
| 344 |
def main():
|
| 345 |
st.title("Job Easz")
|
| 346 |
+
|
| 347 |
+
# Load data
|
| 348 |
df = load_and_concat_data()
|
|
|
|
| 349 |
if df.empty:
|
| 350 |
st.error("No data available. Please check your dataset.")
|
| 351 |
return
|
| 352 |
|
| 353 |
# Sidebar for navigation
|
| 354 |
st.sidebar.title("Navigation")
|
| 355 |
+
page = st.sidebar.radio("Go to", ["Dashboard", "Data Explorer", "About", "Recommender"])
|
| 356 |
|
| 357 |
+
# Navigation logic
|
| 358 |
if page == "Dashboard":
|
| 359 |
display_dashboard(df)
|
| 360 |
elif page == "Data Explorer":
|
| 361 |
display_data_explorer(df)
|
| 362 |
elif page == "About":
|
| 363 |
display_about_page()
|
| 364 |
+
elif page == "Recommender":
|
| 365 |
+
# Check password before accessing Recommender
|
| 366 |
+
if not check_password():
|
| 367 |
+
st.stop()
|
| 368 |
+
else:
|
| 369 |
+
# Content for authenticated users
|
| 370 |
+
st.write("Welcome to the Recommender system!")
|
| 371 |
+
|
| 372 |
|
| 373 |
|
| 374 |
if __name__ == "__main__":
|