Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
# app.py
|
2 |
-
|
3 |
import streamlit as st
|
4 |
from streamlit_option_menu import option_menu
|
5 |
from langchain_groq import ChatGroq
|
@@ -16,7 +14,7 @@ import json
|
|
16 |
# Initialize the LLM with your Groq API key from Streamlit secrets
|
17 |
llm = ChatGroq(
|
18 |
temperature=0,
|
19 |
-
groq_api_key="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",
|
20 |
model_name="llama-3.1-70b-versatile"
|
21 |
)
|
22 |
|
@@ -46,7 +44,7 @@ def extract_job_description(job_link):
|
|
46 |
response = requests.get(job_link, headers=headers)
|
47 |
response.raise_for_status()
|
48 |
soup = BeautifulSoup(response.text, 'html.parser')
|
49 |
-
#
|
50 |
job_description = soup.get_text(separator='\n')
|
51 |
return job_description.strip()
|
52 |
except Exception as e:
|
@@ -190,47 +188,30 @@ def suggest_keywords(resume_text, job_description=None):
|
|
190 |
|
191 |
def get_job_recommendations(resume_text, location="India"):
|
192 |
"""
|
193 |
-
Fetches job recommendations using the
|
194 |
"""
|
195 |
# Extract skills from resume
|
196 |
skills = extract_skills(resume_text)
|
197 |
query = " ".join(skills) if skills else "Software Engineer"
|
198 |
|
199 |
-
url = "https://
|
200 |
-
headers = {
|
201 |
-
"X-RapidAPI-Key": "2a4a8a38a9msh97ce530a89589a6p1d0106jsn1acc0a5ea6bc",
|
202 |
-
"X-RapidAPI-Host": "jsearch.p.rapidapi.com"
|
203 |
-
}
|
204 |
params = {
|
205 |
-
"
|
206 |
-
"
|
207 |
-
"num_pages": "1",
|
208 |
-
"size": "20",
|
209 |
-
"remote_filter": "false",
|
210 |
-
"location": location,
|
211 |
-
"sort": "relevance",
|
212 |
-
"salary_min": "0",
|
213 |
-
"salary_max": "0",
|
214 |
-
"salary_currency": "INR",
|
215 |
-
"radius": "0",
|
216 |
-
"company_type": "",
|
217 |
-
"job_type": "",
|
218 |
-
"degree_level": "",
|
219 |
-
"career_level": "",
|
220 |
-
"include_remote": "false"
|
221 |
}
|
222 |
|
223 |
try:
|
224 |
-
response = requests.get(url,
|
225 |
response.raise_for_status()
|
226 |
data = response.json()
|
227 |
-
jobs = data.get("
|
228 |
job_list = []
|
229 |
for job in jobs:
|
230 |
job_info = {
|
231 |
-
"title": job.get("
|
232 |
-
"company": job.get("
|
233 |
-
"link": job.get("
|
|
|
234 |
}
|
235 |
job_list.append(job_info)
|
236 |
return job_list
|
@@ -473,9 +454,11 @@ def job_recommendations_page():
|
|
473 |
st.subheader("Recommended Jobs")
|
474 |
jobs = get_job_recommendations(resume_text)
|
475 |
if jobs:
|
476 |
-
for job in jobs:
|
477 |
-
st.
|
|
|
478 |
st.markdown(f"[Apply Here]({job['link']})")
|
|
|
479 |
else:
|
480 |
st.write("No job recommendations found based on your skills.")
|
481 |
else:
|
@@ -484,42 +467,63 @@ def job_recommendations_page():
|
|
484 |
def skill_matching_page():
|
485 |
st.header("Skill Matching and Gap Analysis")
|
486 |
|
487 |
-
job_description_input = st.text_area("Paste the job description here:")
|
488 |
uploaded_file = st.file_uploader("Upload your resume (PDF format):", type="pdf")
|
489 |
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
|
513 |
-
|
514 |
-
|
515 |
-
|
|
|
|
|
|
|
516 |
|
517 |
-
st.subheader("Missing Skills")
|
518 |
-
st.write(', '.join(missing_skills) if missing_skills else "No missing skills.")
|
519 |
|
520 |
-
# -------------------------------
|
521 |
-
# Main App with Sidebar Navigation
|
522 |
-
# -------------------------------
|
523 |
|
524 |
def main():
|
525 |
st.set_page_config(page_title="Job Application Assistant", layout="wide")
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from streamlit_option_menu import option_menu
|
3 |
from langchain_groq import ChatGroq
|
|
|
14 |
# Initialize the LLM with your Groq API key from Streamlit secrets
|
15 |
llm = ChatGroq(
|
16 |
temperature=0,
|
17 |
+
groq_api_key="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", # Securely accessing the Groq API key
|
18 |
model_name="llama-3.1-70b-versatile"
|
19 |
)
|
20 |
|
|
|
44 |
response = requests.get(job_link, headers=headers)
|
45 |
response.raise_for_status()
|
46 |
soup = BeautifulSoup(response.text, 'html.parser')
|
47 |
+
# You might need to adjust the selectors based on the website's structure
|
48 |
job_description = soup.get_text(separator='\n')
|
49 |
return job_description.strip()
|
50 |
except Exception as e:
|
|
|
188 |
|
189 |
def get_job_recommendations(resume_text, location="India"):
|
190 |
"""
|
191 |
+
Fetches job recommendations using the Remotive.io API based on the user's skills.
|
192 |
"""
|
193 |
# Extract skills from resume
|
194 |
skills = extract_skills(resume_text)
|
195 |
query = " ".join(skills) if skills else "Software Engineer"
|
196 |
|
197 |
+
url = "https://remotive.io/api/remote-jobs"
|
|
|
|
|
|
|
|
|
198 |
params = {
|
199 |
+
"search": query,
|
200 |
+
"limit": 20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
|
203 |
try:
|
204 |
+
response = requests.get(url, params=params)
|
205 |
response.raise_for_status()
|
206 |
data = response.json()
|
207 |
+
jobs = data.get("jobs", [])
|
208 |
job_list = []
|
209 |
for job in jobs:
|
210 |
job_info = {
|
211 |
+
"title": job.get("title"),
|
212 |
+
"company": job.get("company_name"),
|
213 |
+
"link": job.get("url"),
|
214 |
+
"job_description": job.get("description")
|
215 |
}
|
216 |
job_list.append(job_info)
|
217 |
return job_list
|
|
|
454 |
st.subheader("Recommended Jobs")
|
455 |
jobs = get_job_recommendations(resume_text)
|
456 |
if jobs:
|
457 |
+
for idx, job in enumerate(jobs, 1):
|
458 |
+
st.markdown(f"### Job {idx}")
|
459 |
+
st.write(f"**{job['title']}** at **{job['company']}**")
|
460 |
st.markdown(f"[Apply Here]({job['link']})")
|
461 |
+
st.write("---")
|
462 |
else:
|
463 |
st.write("No job recommendations found based on your skills.")
|
464 |
else:
|
|
|
467 |
def skill_matching_page():
|
468 |
st.header("Skill Matching and Gap Analysis")
|
469 |
|
|
|
470 |
uploaded_file = st.file_uploader("Upload your resume (PDF format):", type="pdf")
|
471 |
|
472 |
+
# Fetch job recommendations once resume is uploaded
|
473 |
+
if uploaded_file:
|
474 |
+
resume_text = extract_text_from_pdf(uploaded_file)
|
475 |
+
if resume_text:
|
476 |
+
st.success("Resume uploaded successfully!")
|
477 |
+
# Fetch job recommendations
|
478 |
+
jobs = get_job_recommendations(resume_text)
|
479 |
+
if jobs:
|
480 |
+
# Display job recommendations with selection
|
481 |
+
job_titles = [f"{job['title']} at {job['company']}" for job in jobs]
|
482 |
+
selected_job = st.selectbox("Select a job for Skill Matching:", job_titles)
|
483 |
+
if selected_job:
|
484 |
+
# Find the selected job's details
|
485 |
+
selected_index = job_titles.index(selected_job)
|
486 |
+
selected_job_info = jobs[selected_index]
|
487 |
+
job_description = selected_job_info['job_description']
|
488 |
+
|
489 |
+
# Extract requirements
|
490 |
+
requirements = extract_requirements(job_description)
|
491 |
+
if not requirements:
|
492 |
+
st.error("Failed to extract requirements.")
|
493 |
+
return
|
494 |
+
|
495 |
+
# Extract skills from resume
|
496 |
+
resume_skills = extract_skills(resume_text)
|
497 |
+
job_skills = extract_skills(job_description)
|
498 |
+
|
499 |
+
# Find matches and gaps
|
500 |
+
matching_skills = set(resume_skills).intersection(set(job_skills))
|
501 |
+
missing_skills = set(job_skills) - set(resume_skills)
|
502 |
+
|
503 |
+
# Display results
|
504 |
+
st.subheader("Matching Skills")
|
505 |
+
st.write(', '.join(matching_skills) if matching_skills else "No matching skills found.")
|
506 |
+
|
507 |
+
st.subheader("Missing Skills")
|
508 |
+
st.write(', '.join(missing_skills) if missing_skills else "No missing skills.")
|
509 |
+
|
510 |
+
# Provide suggestions
|
511 |
+
st.subheader("Suggestions for Improvement")
|
512 |
+
if missing_skills:
|
513 |
+
st.write("- **Acquire Missing Skills:** Consider pursuing courses or certifications in the following areas:")
|
514 |
+
for skill in missing_skills:
|
515 |
+
st.write(f" - {skill}")
|
516 |
+
else:
|
517 |
+
st.write("You have all the required skills for this job!")
|
518 |
|
519 |
+
else:
|
520 |
+
st.write("No job recommendations found based on your skills.")
|
521 |
+
else:
|
522 |
+
st.error("Failed to extract text from resume.")
|
523 |
+
else:
|
524 |
+
st.write("Please upload your resume to perform Skill Matching.")
|
525 |
|
|
|
|
|
526 |
|
|
|
|
|
|
|
527 |
|
528 |
def main():
|
529 |
st.set_page_config(page_title="Job Application Assistant", layout="wide")
|