import streamlit as st from sentence_transformers import SentenceTransformer from sklearn.metrics.pairwise import cosine_similarity @st.cache(allow_output_mutation=True) def load_model(): model = SentenceTransformer('all-MiniLM-L6-v2') return model def calculate_similarity(model, text1, text2): embedding1 = model.encode([text1]) embedding2 = model.encode([text2]) return cosine_similarity(embedding1, embedding2)[0][0] st.title("Resume Matcher") model = load_model() jd = st.text_area("Enter the Job Description:", height=200) resume = st.text_area("Enter the Resume:", height=200) if st.button("Calculate Match Score"): if jd and resume: score = calculate_similarity(model, jd, resume) st.write(f"The match score is: {score}") else: st.write("Please enter both the job description and resume.")