Spaces:
Sleeping
Sleeping
File size: 3,917 Bytes
7e87fe2 5418309 a35efa8 7e87fe2 81bef7b fa458a1 7194e7c 5e33ba4 7194e7c 81bef7b 7194e7c 5e33ba4 7194e7c 4264f7f a35efa8 81bef7b 7e87fe2 a35efa8 7e87fe2 a35efa8 7e87fe2 a35efa8 7e87fe2 a35efa8 7e87fe2 a35efa8 7e87fe2 81bef7b a35efa8 81bef7b a35efa8 81bef7b a35efa8 3916526 81bef7b 5b53197 81bef7b a35efa8 c5f9d42 81bef7b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
import streamlit as st
import os
from langchain_core.prompts import ChatPromptTemplate
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
os.environ["HUGGINGFACEHUB_API_KEY"] = os.getenv("HF")
os.environ["HF_TOKEN"] = os.getenv("HF")
model = HuggingFaceEndpoint(
repo_id="meta-llama/Llama-3.2-3B-Instruct",
provider="novita",
temperature=0.6,
max_new_tokens=300,
task="conversational"
)
llama_model = ChatHuggingFace(
llm=model,
repo_id="meta-llama/Llama-3.2-3B-Instruct",
provider="novita",
temperature=0.6,
max_new_tokens=300,
task="conversational"
)
# session message history
if "message_history" not in st.session_state:
st.session_state.message_history = [
SystemMessage(content="""
You are an expert career advisor specializing in analyzing job descriptions and providing actionable insights to help job seekers tailor their resumes and skills for maximum impact.
Given a Job Description, extract and present the following sections using markdown formatting:
**1. Key Technical Skills**
List the main technical skills required using bullet points.
**2. Important Soft Skills**
List the soft skills emphasized by the employer using bullet points.
**3. Suggested Mini Projects**
Recommend mini projects or learning paths to strengthen the candidate’s profile, using bullet points.
**4. Resume Improvement Tips**
Provide practical and specific tips to improve the candidate's resume, using bullet points.
Use **bold headings** for each section and markdown bullet points (`- `). Write in a professional yet friendly tone. Be concise, clear, and focused on actionable advice.
""")
]
st.set_page_config(page_title="Smart JD Analyzer", page_icon="🧠", layout="wide")
st.markdown("""
<style>
.main-title { font-size: 36px; font-weight: bold; color: #4a7cfc; margin-bottom: 10px; }
.subtitle { font-size: 18px; color: #777777; margin-bottom: 30px; }
.textarea-style textarea {
border-radius: 10px;
padding: 20px;
font-size: 16px;
}
.output-container {
background-color: #f4f8ff;
border-radius: 10px;
padding: 25px;
margin-top: 20px;
box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}
</style>
""", unsafe_allow_html=True)
st.markdown('<div class="main-title">🧠 Smart JD Analyzer</div>', unsafe_allow_html=True)
st.markdown('<div class="subtitle">Paste a job description to get technical skills, soft skills, mini-project ideas, and resume tips instantly!</div>', unsafe_allow_html=True)
jd_input = st.text_area("📄 Paste Job Description Below:", height=300, placeholder="Paste the full job description here...", key="jd_input", help="Paste any software/data-related JD here to analyze it.", label_visibility="visible")
analyze = st.button("🔍 Analyze JD", use_container_width=True)
# --- RESPONSE ---
if analyze:
if jd_input.strip():
with st.spinner("Analyzing job description..."):
st.session_state.message_history.append(HumanMessage(content=jd_input))
try:
response = llama_model.invoke(st.session_state.message_history)
# st.session_state.message_history.append(AIMessage(content=response.content))
with st.container():
st.markdown('<div class="output-container">', unsafe_allow_html=True)
st.markdown("### 📝 **Analysis Output**")
st.markdown(response.content, unsafe_allow_html=True)
st.markdown("</div>", unsafe_allow_html=True)
except Exception as e:
st.error(f"❌ Error occurred: {e}")
else:
st.warning("⚠️ Please enter a valid job description before analyzing.")
|