root commited on
Commit
bdfbee6
·
1 Parent(s): 08f9d0b
Files changed (2) hide show
  1. app.py +3 -14
  2. requirements.txt +0 -1
app.py CHANGED
@@ -2,7 +2,6 @@ import streamlit as st
2
  import pdfplumber
3
  import io
4
  import spacy
5
- from docx import Document
6
  from transformers import pipeline
7
 
8
  st.set_page_config(
@@ -47,13 +46,6 @@ def extract_text_from_pdf(pdf_file):
47
  text += page.extract_text() or ""
48
  return text
49
 
50
- def extract_text_from_docx(docx_file):
51
- doc = Document(docx_file)
52
- text = ""
53
- for paragraph in doc.paragraphs:
54
- text += paragraph.text + "\n"
55
- return text
56
-
57
  def analyze_resume(text, job_title):
58
  # Extract relevant skills
59
  doc = nlp(text.lower())
@@ -89,7 +81,7 @@ col1, col2 = st.columns([2, 1])
89
 
90
  with col1:
91
  # File upload
92
- uploaded_file = st.file_uploader("Upload Resume (PDF or DOCX)", type=["pdf", "docx"])
93
 
94
  with col2:
95
  # Job selection
@@ -104,11 +96,8 @@ if uploaded_file and job_title:
104
  try:
105
  # Show spinner while processing
106
  with st.spinner("Analyzing resume..."):
107
- # Extract text based on file type
108
- if uploaded_file.type == "application/pdf":
109
- text = extract_text_from_pdf(uploaded_file)
110
- else:
111
- text = extract_text_from_docx(uploaded_file)
112
 
113
  # Analyze resume
114
  found_skills, summary = analyze_resume(text, job_title)
 
2
  import pdfplumber
3
  import io
4
  import spacy
 
5
  from transformers import pipeline
6
 
7
  st.set_page_config(
 
46
  text += page.extract_text() or ""
47
  return text
48
 
 
 
 
 
 
 
 
49
  def analyze_resume(text, job_title):
50
  # Extract relevant skills
51
  doc = nlp(text.lower())
 
81
 
82
  with col1:
83
  # File upload
84
+ uploaded_file = st.file_uploader("Upload Resume (PDF)", type=["pdf"])
85
 
86
  with col2:
87
  # Job selection
 
96
  try:
97
  # Show spinner while processing
98
  with st.spinner("Analyzing resume..."):
99
+ # Extract text from PDF
100
+ text = extract_text_from_pdf(uploaded_file)
 
 
 
101
 
102
  # Analyze resume
103
  found_skills, summary = analyze_resume(text, job_title)
requirements.txt CHANGED
@@ -1,6 +1,5 @@
1
  streamlit>=1.31.0
2
  pdfplumber>=0.10.3
3
- python-docx>=1.1.0
4
  transformers>=4.37.2
5
  spacy>=3.7.2
6
  https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl
 
1
  streamlit>=1.31.0
2
  pdfplumber>=0.10.3
 
3
  transformers>=4.37.2
4
  spacy>=3.7.2
5
  https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl