File size: 1,730 Bytes
2e4597a
380da11
2e4597a
44c7429
 
 
380da11
 
 
 
 
 
 
 
 
2e4597a
 
380da11
 
44c7429
 
 
2e4597a
 
44c7429
2e4597a
380da11
2e4597a
380da11
 
2e4597a
 
380da11
2e4597a
 
 
380da11
 
 
 
 
 
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
import streamlit as st
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline

# βœ… MUST be the first Streamlit command
st.set_page_config(page_title="Resume Tailor", layout="centered")

# Load model and tokenizer
@st.cache_resource
def load_pipeline():
    model_name = "Vamsi/T5_Paraphrase_Paws"
    tokenizer = AutoTokenizer.from_pretrained(model_name)
    model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
    return pipeline("text2text-generation", model=model, tokenizer=tokenizer)

rephrase_pipeline = load_pipeline()

def tailor_resume(job_description, resume):
    # Create a concise prompt
    prompt = f"paraphrase: Adapt this resume for the job description.\nJob: {job_description}\nResume: {resume}"
    output = rephrase_pipeline(
        prompt, max_length=512, num_return_sequences=1, clean_up_tokenization_spaces=True
    )[0]["generated_text"]
    return output

# UI
st.title("🎯 Resume Tailoring App")
st.write("Use AI to align your resume with a specific job description.")

job_desc = st.text_area("πŸ“‹ Paste the Job Description:", height=200)
resume_input = st.text_area("🧾 Paste Your Resume:", height=300)

if st.button("Tailor Resume"):
    if not job_desc.strip() or not resume_input.strip():
        st.warning("Please enter both the job description and your resume.")
    else:
        with st.spinner("Tailoring your resume..."):
            try:
                tailored_resume = tailor_resume(job_desc, resume_input)
                st.subheader("πŸŽ‰ Tailored Resume")
                st.text_area("You can now copy your optimized resume:", value=tailored_resume, height=400)
            except Exception as e:
                st.error(f"Something went wrong: {e}")