MoRa2001's picture
Update app.py
9b8f2eb verified
import streamlit as st
from functions import extract_text_from_pdf, git_most_similar_job, generate_gemini_content
import os
#################### Web ############################################################
st.title("Jobs Suitable for each CV ")
info = """- The user uploads his CV in PDF format and passes the number of jobs he wants,
and we display the number of jobs most suitable for each CV from the following recruitment sites,
LinkedIn, Wazzaf, Indeed and Bayt"""
st.write(f":blue[{info}]")
note = " Note : that the jobs currently available are in the fields of programming and technology only"
st.write(f":red[{note}]")
# Set the overall layout width
st.markdown(
"""
<style>
.dataframe {
max-width: 3000px;
margin: auto;
}
</style>
""",
unsafe_allow_html=True,
)
###############################################################################################
# code
uploaded_file = st.file_uploader("Choose a CV file", "pdf")
number_of_jobs = st.number_input("Number of Jobs", min_value=1, step=1, max_value=2000)
submit = st.button("get jobs")
if submit and uploaded_file and number_of_jobs:
st.subheader("The Most recommended jobs is ..... ")
pdf_content = uploaded_file.read() # Read file content
pdf_text = extract_text_from_pdf(pdf_content)
cv_summary = generate_gemini_content(transcript_text=pdf_text)
data_df = git_most_similar_job(cv_summarize=cv_summary, number_of_jobs=number_of_jobs)
st.data_editor(
data_df,
column_config={
"job_link": st.column_config.LinkColumn(
"Job Link",
help=f"The top {number_of_jobs} jobs links",
validate="^https://[a-z]+\.streamlit\.app$",
max_chars=1000,
),
},
hide_index=True,
)
st.success(f"The top {number_of_jobs} jobs")
else:
st.warning("Please upload a PDF file and add number of job .")