Anushkabhat9 pktpaulie commited on
Commit
6e4b6bd
·
verified ·
1 Parent(s): d014ab9

Update Similarity Score Button and Message (#1)

Browse files

- Update Similarity Score Button and Message (7e5d74af430fde43c55640e6120bf72442956b04)


Co-authored-by: Paulie Korukundo <[email protected]>

Files changed (1) hide show
  1. app.py +103 -0
app.py CHANGED
@@ -40,6 +40,98 @@ st.markdown("""
40
  st.title("Resume Tailoring with Google Generative AI")
41
  st.markdown("### Upload your resume and job description to check similarity and generate a tailored resume.")
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  # Two columns for file uploaders
44
  col1, col2 = st.columns(2)
45
  with col1:
@@ -61,6 +153,17 @@ if uploaded_resume and uploaded_job_description:
61
  similarity_score = similarity_main(resume_path, job_description_path)
62
  if isinstance(similarity_score, str) and '%' in similarity_score:
63
  similarity_score = float(similarity_score.replace('%', ''))
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  # Display Score as a Pie Chart
66
  st.markdown(f"### Similarity Score: {int(similarity_score)}%")
 
40
  st.title("Resume Tailoring with Google Generative AI")
41
  st.markdown("### Upload your resume and job description to check similarity and generate a tailored resume.")
42
 
43
+ # Two columns for file uploaders
44
+ col1, col2 = st.columns(2)
45
+ with col1:
46
+ uploaded_resume = st.file_uploader("Upload Current Resume (.docx or .pdf)", type=["docx", "pdf"], key="resume")
47
+ with col2:
48
+ uploaded_job_description = st.file_uploader("Upload Job Description (.docx or .pdf)", type=["docx", "pdf"], key="job_description")
49
+
50
+ # Process if files are uploaded
51
+ if uploaded_resume and uploaded_job_description:
52
+ # Save files
53
+ resume_path = save_uploaded_file(uploaded_resume)
54
+ job_description_path = save_uploaded_file(uploaded_job_description)
55
+
56
+ # Similarity Score Section
57
+ st.markdown("---")
58
+ st.subheader("Check Resume Similarity")
59
+
60
+ if st.btn("Check Similarity Score"):
61
+ similarity_score = similarity_main(resume_path, job_description_path)
62
+ if isinstance(similarity_score, str) and '%' in similarity_score:
63
+ similarity_score = float(similarity_score.replace('%', ''))
64
+ # Custom CSS for styling
65
+ st.markdown("""
66
+ <style>
67
+ .main {
68
+ background-color: #f5f5f5;
69
+ font-family: Arial, sans-serif;
70
+ }
71
+ h1, h2 {
72
+ color: #4B7BE5;
73
+ text-align: center;
74
+ }
75
+ .stButton>button {
76
+ background-color: #4B7BE5;
77
+ color: white;
78
+ font-size: 18px;
79
+ }
80
+ .stButton>button:hover {
81
+ background-color: #3A6FD8;
82
+ color: white;
83
+ }
84
+
85
+ /* From Uiverse.io by e-coders */
86
+ btn {
87
+ appearance: none;
88
+ background-color: transparent;
89
+ border: 0.125em solid #1A1A1A;
90
+ border-radius: 0.9375em;
91
+ box-sizing: border-box;
92
+ color: #3B3B3B;
93
+ cursor: pointer;
94
+ display: inline-block;
95
+ font-family: Roobert,-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
96
+ font-size: 16px;
97
+ font-weight: 600;
98
+ line-height: normal;
99
+ margin: 0;
100
+ min-height: 3.75em;
101
+ min-width: 0;
102
+ outline: none;
103
+ padding: 1em 2.3em;
104
+ text-align: center;
105
+ text-decoration: none;
106
+ transition: all 300ms cubic-bezier(.23, 1, 0.32, 1);
107
+ user-select: none;
108
+ -webkit-user-select: none;
109
+ touch-action: manipulation;
110
+ will-change: transform;
111
+ }
112
+
113
+ btn:disabled {
114
+ pointer-events: none;
115
+ }
116
+
117
+ btn:hover {
118
+ color: #fff;
119
+ background-color: #1A1A1A;
120
+ box-shadow: rgba(0, 0, 0, 0.25) 0 8px 15px;
121
+ transform: translateY(-2px);
122
+ }
123
+
124
+ btn:active {
125
+ box-shadow: none;
126
+ transform: translateY(0);
127
+ }
128
+ </style>
129
+ """, unsafe_allow_html=True)
130
+
131
+ # Title and Description
132
+ st.title("Resume Tailoring with Google Generative AI")
133
+ st.markdown("### Upload your resume and job description to check similarity and generate a tailored resume.")
134
+
135
  # Two columns for file uploaders
136
  col1, col2 = st.columns(2)
137
  with col1:
 
153
  similarity_score = similarity_main(resume_path, job_description_path)
154
  if isinstance(similarity_score, str) and '%' in similarity_score:
155
  similarity_score = float(similarity_score.replace('%', ''))
156
+
157
+ # Display messages based on score range
158
+ if similarity_score < 50:
159
+ st.subheader(colored("Low chance, need to modify your CV!", "red", attrs=["bold"]))
160
+ pie_colors = ['#FF4B4B', '#E5E5E5']
161
+ elif 50 <= similarity_score < 70:
162
+ st.subheader(colored("Good chance but you can improve further!", "yellow", attrs=["bold"]))
163
+ pie_colors = ['#FFC107', '#E5E5E5']
164
+ else:
165
+ st.subheader(colored("Excellent! You can submit your CV.", "green", attrs=["bold"]))
166
+ pie_colors = ['#4CAF50', '#E5E5E5']
167
 
168
  # Display Score as a Pie Chart
169
  st.markdown(f"### Similarity Score: {int(similarity_score)}%")