Spaces:
Sleeping
Sleeping
File size: 2,603 Bytes
eac86bd 4f9ccca 3375644 4f9ccca 3375644 4f9ccca eac86bd 4f9ccca e8fcb96 3375644 e8fcb96 4f9ccca 3375644 4f9ccca eac86bd 4f9ccca 3375644 4f9ccca 3375644 4f9ccca eac86bd 4f9ccca e8fcb96 81b305c 4f9ccca 3375644 4f9ccca 81b305c 4f9ccca 81b305c 4f9ccca 3375644 d305e90 4f9ccca d305e90 4f9ccca 3375644 d305e90 6e8b154 4f9ccca 3375644 4f9ccca 3375644 4f9ccca | 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 | import streamlit as st
from utils import extract_text_from_pdf, calculate_similarity
from resume_generator import get_missing_keywords, generate_latex, generate_pdf
st.set_page_config(page_title="AI Resume Analyzer")
st.title("π€ AI Resume Analyzer")
# -------------------------
# SESSION STATE
# -------------------------
if "resume_text" not in st.session_state:
st.session_state.resume_text = None
if "job_desc" not in st.session_state:
st.session_state.job_desc = None
if "keywords" not in st.session_state:
st.session_state.keywords = []
# -------------------------
# INPUT
# -------------------------
uploaded_file = st.file_uploader("Upload Resume", type=["pdf"])
job_desc = st.text_area("Paste Job Description")
# -------------------------
# ANALYZE
# -------------------------
if st.button("π Analyze Resume"):
if uploaded_file and job_desc:
resume_text = extract_text_from_pdf(uploaded_file)
st.session_state.resume_text = resume_text
st.session_state.job_desc = job_desc
score = calculate_similarity(resume_text, job_desc)
st.subheader(f"Match Score: {score}%")
else:
st.warning("Upload resume and enter job description")
# -------------------------
# AI SUGGESTIONS (KEYWORDS)
# -------------------------
if st.session_state.resume_text:
if st.button("π‘ Get Missing Keywords"):
keywords = get_missing_keywords(
st.session_state.resume_text,
st.session_state.job_desc
)
st.session_state.keywords = keywords
st.write("### π Missing Keywords:")
st.write(", ".join(keywords))
# -------------------------
# RESUME GENERATION
# -------------------------
if st.session_state.resume_text:
st.markdown("## π Generate Resume")
col1, col2 = st.columns(2)
with col1:
latex_btn = st.button("π§Ύ Generate LaTeX")
with col2:
pdf_btn = st.button("π₯ Download PDF")
# sample structured data (later you can auto-extract)
data = {
"name": "Jashan Malhotra",
"location": "Bengaluru, India",
"summary": "Software Engineer and Data Analyst",
"skills": st.session_state.keywords if st.session_state.keywords else ["Python", "SQL"]
}
if latex_btn:
latex_code = generate_latex(data)
st.code(latex_code, language="latex")
if pdf_btn:
pdf_file = generate_pdf(data)
st.download_button(
label="Download PDF",
data=pdf_file,
file_name="resume.pdf",
mime="application/pdf"
) |