Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from langchain_core.prompts import PromptTemplate
|
| 3 |
+
from langchain_community.chat_models import ChatHuggingFace
|
| 4 |
+
|
| 5 |
+
# Setup LLM
|
| 6 |
+
llm_model = ChatHuggingFace(
|
| 7 |
+
repo_id="HuggingFaceH4/zephyr-7b-beta",
|
| 8 |
+
task="conversational",
|
| 9 |
+
temperature=0.7,
|
| 10 |
+
max_new_tokens=300,
|
| 11 |
+
model="huggingface",
|
| 12 |
+
provider="hf-inference"
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
# Prompt template
|
| 16 |
+
prompt = PromptTemplate.from_template("""
|
| 17 |
+
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.
|
| 18 |
+
|
| 19 |
+
Given the Job Description below, extract and present the following sections **using markdown formatting**:
|
| 20 |
+
|
| 21 |
+
**1. Key Technical Skills**
|
| 22 |
+
List the main technical skills required using bullet points.
|
| 23 |
+
|
| 24 |
+
**2. Important Soft Skills**
|
| 25 |
+
List the soft skills emphasized by the employer using bullet points.
|
| 26 |
+
|
| 27 |
+
**3. Suggested Mini Projects**
|
| 28 |
+
Recommend mini projects or learning paths to strengthen the candidate’s profile, using bullet points.
|
| 29 |
+
|
| 30 |
+
**4. Resume Improvement Tips**
|
| 31 |
+
Provide practical and specific tips to improve the candidate's resume, using bullet points.
|
| 32 |
+
|
| 33 |
+
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.
|
| 34 |
+
|
| 35 |
+
Job Description:
|
| 36 |
+
\"\"\"{job_description}\"\"\"
|
| 37 |
+
|
| 38 |
+
""")
|
| 39 |
+
|
| 40 |
+
# Chain
|
| 41 |
+
chain = prompt | llm_model
|
| 42 |
+
|
| 43 |
+
# Streamlit UI
|
| 44 |
+
st.set_page_config(page_title="JD Analyzer AI")
|
| 45 |
+
st.title("📄 JD Analyzer AI")
|
| 46 |
+
st.markdown("Paste any job description below and get insights to improve your profile.")
|
| 47 |
+
|
| 48 |
+
jd_input = st.text_area("Paste Job Description:", height=300)
|
| 49 |
+
|
| 50 |
+
if st.button("Analyze"):
|
| 51 |
+
with st.spinner("Analyzing the JD..."):
|
| 52 |
+
output = chain.invoke({"job_description": jd_input})
|
| 53 |
+
st.markdown("### 🔍 Output")
|
| 54 |
+
st.markdown(output)
|