Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,24 @@ load_dotenv()
|
|
| 16 |
groq_api_key = os.getenv("GROQ_API_KEY")
|
| 17 |
os.environ["GROQ_API_KEY"] = groq_api_key
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
def extract_text_from_pdf(pdf_file):
|
| 20 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as temp:
|
| 21 |
temp.write(pdf_file)
|
|
@@ -31,8 +49,31 @@ def extract_skills(text):
|
|
| 31 |
def generate_learning_resources(missing_skills):
|
| 32 |
suggestions = []
|
| 33 |
for skill in missing_skills:
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
def generate_skill_gap_report(user_skills, job_skills, missing_skills, match_percent):
|
| 38 |
llm = ChatGroq(model="llama3-8b-8192", temperature=0.2)
|
|
|
|
| 16 |
groq_api_key = os.getenv("GROQ_API_KEY")
|
| 17 |
os.environ["GROQ_API_KEY"] = groq_api_key
|
| 18 |
|
| 19 |
+
import requests
|
| 20 |
+
from bs4 import BeautifulSoup
|
| 21 |
+
|
| 22 |
+
def scrape_skills_from_jd_link(url):
|
| 23 |
+
try:
|
| 24 |
+
response = requests.get(url, timeout=10)
|
| 25 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
| 26 |
+
text = soup.get_text(separator=' ', strip=True)
|
| 27 |
+
|
| 28 |
+
# Basic keyword match for now
|
| 29 |
+
skills_list = ["Python", "SQL", "Machine Learning", "Deep Learning", "NLP", "Cloud", "TensorFlow", "Java", "C++", "HTML", "CSS", "JavaScript"]
|
| 30 |
+
extracted_skills = [skill for skill in skills_list if skill.lower() in text.lower()]
|
| 31 |
+
|
| 32 |
+
return extracted_skills if extracted_skills else ["No skills detected."]
|
| 33 |
+
except Exception as e:
|
| 34 |
+
return [f"Error fetching JD: {str(e)}"]
|
| 35 |
+
|
| 36 |
+
|
| 37 |
def extract_text_from_pdf(pdf_file):
|
| 38 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as temp:
|
| 39 |
temp.write(pdf_file)
|
|
|
|
| 49 |
def generate_learning_resources(missing_skills):
|
| 50 |
suggestions = []
|
| 51 |
for skill in missing_skills:
|
| 52 |
+
search_link = f"https://www.google.com/search?q={skill}+online+course"
|
| 53 |
+
youtube_link = f"https://www.youtube.com/results?search_query={skill}+tutorial"
|
| 54 |
+
suggestions.append(f"🔎 [{skill} Courses on Google]({search_link})\n▶️ [YouTube Tutorials]({youtube_link})\n")
|
| 55 |
+
return "\n\n".join(suggestions)
|
| 56 |
+
|
| 57 |
+
def suggest_certifications(missing_skills):
|
| 58 |
+
cert_mapping = {
|
| 59 |
+
"Python": "Python for Everybody (Coursera)",
|
| 60 |
+
"Machine Learning": "Machine Learning by Andrew Ng (Coursera)",
|
| 61 |
+
"Cloud": "AWS Certified Solutions Architect",
|
| 62 |
+
"SQL": "Google Data Analytics Certificate",
|
| 63 |
+
"TensorFlow": "TensorFlow Developer Certificate",
|
| 64 |
+
"NLP": "Natural Language Processing Specialization (DeepLearning.AI)",
|
| 65 |
+
"Java": "Oracle Certified Java Programmer",
|
| 66 |
+
"C++": "C++ Nanodegree (Udacity)"
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
suggestions = []
|
| 70 |
+
for skill in missing_skills:
|
| 71 |
+
if skill in cert_mapping:
|
| 72 |
+
suggestions.append(f"{skill}: {cert_mapping[skill]}")
|
| 73 |
+
|
| 74 |
+
return "\n".join(suggestions) if suggestions else "No specific certifications recommended."
|
| 75 |
+
|
| 76 |
+
|
| 77 |
|
| 78 |
def generate_skill_gap_report(user_skills, job_skills, missing_skills, match_percent):
|
| 79 |
llm = ChatGroq(model="llama3-8b-8192", temperature=0.2)
|