Spaces:
Sleeping
Sleeping
File size: 3,061 Bytes
92adbc4 787c07d 2880f9e 787c07d 9b9d05d 92adbc4 787c07d 92adbc4 787c07d 92adbc4 787c07d 92adbc4 787c07d 92adbc4 787c07d 9b9d05d 02f7cad 787c07d 02f7cad 2880f9e 787c07d 2880f9e 9b9d05d 787c07d 92adbc4 787c07d 9b9d05d 787c07d 92adbc4 787c07d |
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 |
# -*- coding: utf-8 -*-
import streamlit as st
import os
import pandas as pd
import matplotlib.pyplot as plt
from resume_generation_gemini_pro import Gemini_pro_main
from similarity_score_refined import similarity_main
# Helper function to save uploaded files temporarily and return their paths
def save_uploaded_file(uploaded_file):
file_path = os.path.join("/tmp", uploaded_file.name)
with open(file_path, "wb") as f:
f.write(uploaded_file.getbuffer())
return file_path
# Custom CSS for styling
st.markdown("""
<style>
.main {
background-color: #f5f5f5;
font-family: Arial, sans-serif;
}
h1, h2 {
color: #4B7BE5;
text-align: center;
}
.stButton>button {
background-color: #4B7BE5;
color: white;
font-size: 18px;
}
.stButton>button:hover {
background-color: #3A6FD8;
color: white;
}
</style>
""", unsafe_allow_html=True)
# Title and Description
st.title("Resume Tailoring with Google Generative AI")
st.markdown("### Upload your resume and job description to check similarity and generate a tailored resume.")
# Two columns for file uploaders
col1, col2 = st.columns(2)
with col1:
uploaded_resume = st.file_uploader("Upload Current Resume (.docx or .pdf)", type=["docx", "pdf"], key="resume")
with col2:
uploaded_job_description = st.file_uploader("Upload Job Description (.docx or .pdf)", type=["docx", "pdf"], key="job_description")
# Process if files are uploaded
if uploaded_resume and uploaded_job_description:
# Save files
resume_path = save_uploaded_file(uploaded_resume)
job_description_path = save_uploaded_file(uploaded_job_description)
# Similarity Score Section
st.markdown("---")
st.subheader("Check Resume Similarity")
if st.button("Check Similarity Score"):
similarity_score = similarity_main(resume_path, job_description_path)
if isinstance(similarity_score, str) and '%' in similarity_score:
similarity_score = float(similarity_score.replace('%', ''))
# Display Score as a Pie Chart
st.markdown(f"### Similarity Score: {int(similarity_score)}%")
# Pie chart to show similarity
fig, ax = plt.subplots()
ax.pie([similarity_score, 100 - similarity_score], labels=['Match', 'Difference'], autopct='%1.1f%%', startangle=140, colors=['#4B7BE5', '#E5E5E5'])
ax.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
st.pyplot(fig)
# Generate Tailored Resume Section
st.markdown("---")
st.subheader("Generate Tailored Resume")
if st.button("Generate Tailored Resume"):
with st.spinner("Generating resume..."):
generated_resume = Gemini_pro_main(resume_path, job_description_path)
st.subheader("Generated Tailored Resume:")
st.write(generated_resume)
else:
st.warning("Please upload both the resume and job description files.")
|