Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,42 +1,41 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
platforms = {
|
| 5 |
"LinkedIn": "https://www.linkedin.com/jobs/search/?keywords={job}&location={city}",
|
| 6 |
-
"Indeed": "https://
|
| 7 |
-
"
|
| 8 |
}
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
#
|
| 20 |
-
if
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
elif st.session_state['button_state'] == "See Jobs":
|
| 36 |
-
# Open the link in a new tab
|
| 37 |
-
base_url = platforms[selected_platform]
|
| 38 |
-
search_url = base_url.format(job=job_keyword.replace(" ", "+"), city=selected_city)
|
| 39 |
-
st.markdown(f'<a href="{search_url}" target="_blank">Open Jobs in New Tab</a>', unsafe_allow_html=True)
|
| 40 |
-
|
| 41 |
-
# Reset button state for new searches
|
| 42 |
-
st.session_state['button_state'] = "Search Jobs"
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
# Expanded list of Pakistani cities
|
| 4 |
+
cities = [
|
| 5 |
+
"Karachi", "Lahore", "Islamabad", "Rawalpindi", "Peshawar", "Quetta",
|
| 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
|
| 22 |
+
st.subheader("Search for Jobs in Pakistan")
|
| 23 |
+
selected_city = st.selectbox("Select your city:", cities)
|
| 24 |
+
job_keyword = st.text_input("Enter job title or keywords:")
|
| 25 |
+
selected_platform = st.selectbox("Choose the job platform:", list(platforms.keys()))
|
| 26 |
+
|
| 27 |
+
# Show the Search button and create the link if clicked
|
| 28 |
+
if st.button("Search Jobs"):
|
| 29 |
+
if not job_keyword.strip():
|
| 30 |
+
st.warning("Please enter a job title or keyword.")
|
| 31 |
+
else:
|
| 32 |
+
# Construct the URL for the selected platform
|
| 33 |
+
base_url = platforms[selected_platform]
|
| 34 |
+
search_url = base_url.format(job=job_keyword.replace(" ", "+"), city=selected_city)
|
| 35 |
+
|
| 36 |
+
# Create the dynamic link for the platform
|
| 37 |
+
link_text = f"See {selected_platform} Jobs in {selected_city}"
|
| 38 |
+
|
| 39 |
+
# Display the dynamic link
|
| 40 |
+
st.markdown(f"[{link_text}]({search_url})", unsafe_allow_html=True)
|
| 41 |
+
st.success(f"Click the link above to see jobs on {selected_platform}.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|