Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,8 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
|
6 |
-
"Faisalabad", "Multan", "Sialkot", "Hyderabad", "Gujranwala", "Bahawalpur",
|
7 |
-
"Abbottabad", "Sargodha", "Mardan", "Mirpur", "Sukkur", "Larkana",
|
8 |
-
"Chiniot", "Sheikhupura", "Gujrat", "Jhelum", "Dera Ghazi Khan", "Nawabshah"
|
9 |
-
]
|
10 |
-
|
11 |
-
# Platforms with job search URLs
|
12 |
-
platforms = {
|
13 |
-
"LinkedIn": "https://www.linkedin.com/jobs/search/?keywords={job}&location={city}",
|
14 |
-
"Indeed": "https://pk.indeed.com/jobs?q={job}&l={city}",
|
15 |
-
"National Job Portal": "https://njp.gov.pk/job_search?keywords={job}&city={city}"
|
16 |
-
}
|
17 |
-
|
18 |
-
# App Title
|
19 |
-
st.title("Job Search Portal")
|
20 |
-
|
21 |
-
# User Inputs (with empty initial selection)
|
22 |
-
st.subheader("Search for Jobs in Pakistan")
|
23 |
-
selected_city = st.selectbox("Select your city:", [""] + cities) # Add empty string
|
24 |
-
job_keyword = st.text_input("Enter job title or keywords:")
|
25 |
-
selected_platform = st.selectbox("Choose the job platform:", [""] + list(platforms.keys())) # Add empty string
|
26 |
|
27 |
# Initialize button state
|
28 |
button_state = "Search Jobs"
|
@@ -39,7 +19,9 @@ else:
|
|
39 |
|
40 |
# Change button state
|
41 |
button_state = "See Jobs"
|
42 |
-
|
|
|
|
|
43 |
|
44 |
elif button_state == "See Jobs":
|
45 |
# Open the link in a new tab
|
@@ -49,8 +31,8 @@ else:
|
|
49 |
|
50 |
# Reset button state for new searches.
|
51 |
button_state = "Search Jobs"
|
52 |
-
st.
|
53 |
|
54 |
-
#
|
55 |
if 'button_state' not in st.session_state:
|
56 |
st.session_state['button_state'] = "Search Jobs"
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# ... (rest of your code)
|
4 |
+
|
5 |
+
# ... (User inputs with empty initial selection)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Initialize button state
|
8 |
button_state = "Search Jobs"
|
|
|
19 |
|
20 |
# Change button state
|
21 |
button_state = "See Jobs"
|
22 |
+
|
23 |
+
# Use st.session_state to preserve button state
|
24 |
+
st.session_state['button_state'] = button_state
|
25 |
|
26 |
elif button_state == "See Jobs":
|
27 |
# Open the link in a new tab
|
|
|
31 |
|
32 |
# Reset button state for new searches.
|
33 |
button_state = "Search Jobs"
|
34 |
+
st.session_state['button_state'] = button_state
|
35 |
|
36 |
+
# Ensure button_state is initialized in st.session_state
|
37 |
if 'button_state' not in st.session_state:
|
38 |
st.session_state['button_state'] = "Search Jobs"
|