Resume_editor / app.py
HudaQamber's picture
Update app.py
44c7429 verified
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}")