Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,39 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import pipeline
|
3 |
|
4 |
-
# Load
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
def tailor_resume(job_description, resume):
|
8 |
-
|
9 |
-
|
|
|
10 |
return output
|
11 |
|
|
|
12 |
st.set_page_config(page_title="Resume Tailor", layout="centered")
|
13 |
|
14 |
st.title("π― Resume Tailoring App")
|
15 |
-
st.write("
|
16 |
|
17 |
-
job_desc = st.text_area("π Paste the Job Description
|
18 |
-
resume_input = st.text_area("π§Ύ Paste Your Resume
|
19 |
|
20 |
if st.button("Tailor Resume"):
|
21 |
-
if job_desc.strip()
|
22 |
st.warning("Please enter both the job description and your resume.")
|
23 |
else:
|
24 |
with st.spinner("Tailoring your resume..."):
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
3 |
|
4 |
+
# Load model and tokenizer
|
5 |
+
@st.cache_resource
|
6 |
+
def load_pipeline():
|
7 |
+
model_name = "Vamsi/T5_Paraphrase_Paws"
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
10 |
+
return pipeline("text2text-generation", model=model, tokenizer=tokenizer)
|
11 |
+
|
12 |
+
rephrase_pipeline = load_pipeline()
|
13 |
|
14 |
def tailor_resume(job_description, resume):
|
15 |
+
# Create a concise prompt
|
16 |
+
prompt = f"paraphrase: Adapt this resume for the job description.\nJob: {job_description}\nResume: {resume}"
|
17 |
+
output = rephrase_pipeline(prompt, max_length=512, num_return_sequences=1, clean_up_tokenization_spaces=True)[0]["generated_text"]
|
18 |
return output
|
19 |
|
20 |
+
# Streamlit UI
|
21 |
st.set_page_config(page_title="Resume Tailor", layout="centered")
|
22 |
|
23 |
st.title("π― Resume Tailoring App")
|
24 |
+
st.write("Use AI to align your resume with a specific job description.")
|
25 |
|
26 |
+
job_desc = st.text_area("π Paste the Job Description:", height=200)
|
27 |
+
resume_input = st.text_area("π§Ύ Paste Your Resume:", height=300)
|
28 |
|
29 |
if st.button("Tailor Resume"):
|
30 |
+
if not job_desc.strip() or not resume_input.strip():
|
31 |
st.warning("Please enter both the job description and your resume.")
|
32 |
else:
|
33 |
with st.spinner("Tailoring your resume..."):
|
34 |
+
try:
|
35 |
+
tailored_resume = tailor_resume(job_desc, resume_input)
|
36 |
+
st.subheader("π Tailored Resume")
|
37 |
+
st.text_area("You can now copy your optimized resume:", value=tailored_resume, height=400)
|
38 |
+
except Exception as e:
|
39 |
+
st.error(f"Something went wrong: {e}")
|