Spaces:
Build error
Build error
Create Create ui_components.py
Browse files- Create ui_components.py +99 -0
Create ui_components.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from typing import Dict, List, Any, Optional
|
| 3 |
+
|
| 4 |
+
def render_header():
|
| 5 |
+
"""Render the application header"""
|
| 6 |
+
st.title("📄 Resume Analyzer & Job Matcher")
|
| 7 |
+
st.markdown("""
|
| 8 |
+
Upload your resume to get personalized job matches, identify skill gaps,
|
| 9 |
+
and receive recommendations for improvement.
|
| 10 |
+
""")
|
| 11 |
+
st.divider()
|
| 12 |
+
|
| 13 |
+
def render_upload_section():
|
| 14 |
+
"""Render the file upload section"""
|
| 15 |
+
st.subheader("Upload Your Resume")
|
| 16 |
+
st.markdown("Supported formats: PDF, DOCX")
|
| 17 |
+
|
| 18 |
+
uploaded_file = st.file_uploader("Choose a file", type=["pdf", "docx"])
|
| 19 |
+
|
| 20 |
+
if uploaded_file is not None:
|
| 21 |
+
st.success(f"File uploaded: {uploaded_file.name}")
|
| 22 |
+
|
| 23 |
+
file_details = {
|
| 24 |
+
"Filename": uploaded_file.name,
|
| 25 |
+
"File size": f"{uploaded_file.size / 1024:.2f} KB",
|
| 26 |
+
"File type": uploaded_file.type
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
with st.expander("File Details"):
|
| 30 |
+
for key, value in file_details.items():
|
| 31 |
+
st.write(f"**{key}:** {value}")
|
| 32 |
+
|
| 33 |
+
return uploaded_file
|
| 34 |
+
|
| 35 |
+
def render_results_section(
|
| 36 |
+
resume_data: Any,
|
| 37 |
+
job_matches: List[Dict[str, Any]],
|
| 38 |
+
skill_gaps: List[Dict[str, Any]],
|
| 39 |
+
improvement_tips: List[str]
|
| 40 |
+
):
|
| 41 |
+
"""Render the results section with analysis output"""
|
| 42 |
+
st.divider()
|
| 43 |
+
st.header("Analysis Results")
|
| 44 |
+
|
| 45 |
+
# Create tabs for different result categories
|
| 46 |
+
tab1, tab2, tab3 = st.tabs(["Job Matches", "Skill Gaps", "Resume Improvement"])
|
| 47 |
+
|
| 48 |
+
# Tab 1: Job Matches
|
| 49 |
+
with tab1:
|
| 50 |
+
st.subheader("Recommended Job Roles")
|
| 51 |
+
if not job_matches:
|
| 52 |
+
st.info("No job matches found. Please try uploading a different resume.")
|
| 53 |
+
else:
|
| 54 |
+
for i, job in enumerate(job_matches):
|
| 55 |
+
with st.container():
|
| 56 |
+
col1, col2 = st.columns([3, 1])
|
| 57 |
+
with col1:
|
| 58 |
+
st.markdown(f"### {i+1}. {job.get('title', 'Unknown Job')}")
|
| 59 |
+
st.markdown(f"**Match Score:** {job.get('match_score', 'N/A')}%")
|
| 60 |
+
st.markdown(f"**Description:** {job.get('description', 'No description available')}")
|
| 61 |
+
with col2:
|
| 62 |
+
st.markdown("**Matching Skills:**")
|
| 63 |
+
for skill in job.get('key_matching_skills', []):
|
| 64 |
+
st.markdown(f"- {skill}")
|
| 65 |
+
st.divider()
|
| 66 |
+
|
| 67 |
+
# Tab 2: Skill Gaps
|
| 68 |
+
with tab2:
|
| 69 |
+
st.subheader("Skill Gap Analysis")
|
| 70 |
+
if not skill_gaps:
|
| 71 |
+
st.info("No skill gaps identified.")
|
| 72 |
+
else:
|
| 73 |
+
for skill_gap in skill_gaps:
|
| 74 |
+
with st.container():
|
| 75 |
+
col1, col2 = st.columns([1, 2])
|
| 76 |
+
with col1:
|
| 77 |
+
st.markdown(f"### {skill_gap.get('skill', 'Unknown Skill')}")
|
| 78 |
+
st.markdown(f"**Importance:** {skill_gap.get('importance', 'Medium')}")
|
| 79 |
+
with col2:
|
| 80 |
+
st.markdown("**How to acquire this skill:**")
|
| 81 |
+
st.markdown(skill_gap.get('acquisition_recommendation', 'No recommendation available'))
|
| 82 |
+
st.divider()
|
| 83 |
+
|
| 84 |
+
# Tab 3: Resume Improvement
|
| 85 |
+
with tab3:
|
| 86 |
+
st.subheader("Resume Improvement Tips")
|
| 87 |
+
if not improvement_tips:
|
| 88 |
+
st.info("No improvement tips available.")
|
| 89 |
+
else:
|
| 90 |
+
for i, tip in enumerate(improvement_tips):
|
| 91 |
+
st.markdown(f"**{i+1}.** {tip}")
|
| 92 |
+
|
| 93 |
+
def render_footer():
|
| 94 |
+
"""Render the application footer"""
|
| 95 |
+
st.divider()
|
| 96 |
+
st.markdown("""
|
| 97 |
+
**Note:** This application uses AI to analyze your resume and provide recommendations.
|
| 98 |
+
The results should be considered as suggestions and may not be 100% accurate.
|
| 99 |
+
""")
|