Update app.py
Browse files
app.py
CHANGED
|
@@ -22,16 +22,51 @@ os.environ['HF_TOKEN'] = hk
|
|
| 22 |
# accessing the llm
|
| 23 |
# ------ accesssing the llm for geenral prompting -------------------
|
| 24 |
llm_skeleton = HuggingFaceEndpoint(repo_id='meta-llama/Llama-3.2-3B-Instruct',
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# accessing the llm
|
| 23 |
# ------ accesssing the llm for geenral prompting -------------------
|
| 24 |
llm_skeleton = HuggingFaceEndpoint(repo_id='meta-llama/Llama-3.2-3B-Instruct',
|
| 25 |
+
provider='novita',
|
| 26 |
+
temperature=0.7,
|
| 27 |
+
max_new_tokens=150,
|
| 28 |
+
task='conversational')
|
| 29 |
+
llm = ChatHuggingFace(llm=llm_skeleton,
|
| 30 |
+
repo_id='meta-llama/Llama-3.2-3B-Instruct',
|
| 31 |
+
provider='novita',
|
| 32 |
+
temperature=0.7,
|
| 33 |
+
max_new_tokens=150,
|
| 34 |
+
task='conversational')
|
| 35 |
|
| 36 |
+
# App Layout
|
| 37 |
+
st.title("📄 Resume & Job Description Extractor")
|
| 38 |
|
| 39 |
+
# Upload Resume PDF
|
| 40 |
+
resume_file = st.file_uploader("Upload Resume (PDF)", type=["pdf"])
|
| 41 |
+
|
| 42 |
+
# Upload or Input Job Description
|
| 43 |
+
jd_file = st.file_uploader("Upload Job Description (PDF or TXT)", type=["pdf", "txt"])
|
| 44 |
+
jd_text = st.text_area("Or paste Job Description text here")
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if st.button("Extract Data"):
|
| 50 |
+
if resume_file:
|
| 51 |
+
# Extract text from resume
|
| 52 |
+
loader = UnstructuredPDFLoader(resume_file)
|
| 53 |
+
resume_text = loader.load()[0].page_content
|
| 54 |
+
|
| 55 |
+
# LLM prompt for resume extraction
|
| 56 |
+
resume_prompt = f"Extract the following from the resume:\n1. Name\n2. Education\n3. Experience\n4. Skills\n5. Project Names and Results\n\nResume:\n{resume_text}"
|
| 57 |
+
resume_data = llm.invoke(resume_prompt)
|
| 58 |
+
st.subheader("Extracted Resume Data")
|
| 59 |
+
st.write(resume_data)
|
| 60 |
+
|
| 61 |
+
if jd_file or jd_text:
|
| 62 |
+
if jd_file:
|
| 63 |
+
loader = UnstructuredPDFLoader(jd_file)
|
| 64 |
+
jd_text_extracted = loader.load()[0].page_content
|
| 65 |
+
else:
|
| 66 |
+
jd_text_extracted = jd_text
|
| 67 |
+
|
| 68 |
+
# LLM prompt for JD extraction
|
| 69 |
+
jd_prompt = f"Extract the following from the job description:\n1. Job ID\n2. Company Name\n3. Role\n4. Experience Required\n5. Skills Required\n6. Education Required\n7. Location\n\nJob Description:\n{jd_text_extracted}"
|
| 70 |
+
jd_data = llm.invoke(jd_prompt)
|
| 71 |
+
st.subheader("Extracted Job Description Data")
|
| 72 |
+
st.write(jd_data)
|