Spaces:
Sleeping
Sleeping
DreamStream-1
commited on
Commit
•
45921c5
1
Parent(s):
523e3d6
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import spacy
|
2 |
import streamlit as st
|
3 |
import subprocess
|
4 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
@@ -7,27 +6,17 @@ import PyPDF2
|
|
7 |
import nltk
|
8 |
from nltk.corpus import stopwords
|
9 |
from nltk.tokenize import word_tokenize
|
|
|
10 |
from gemini_flash import GeminiFlash # Adjust if Gemini Flash is available
|
11 |
|
12 |
# Ensure that NLTK's stopwords are available
|
13 |
nltk.download('punkt')
|
14 |
nltk.download('stopwords')
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
nlp = spacy.load("en_core_web_sm")
|
21 |
-
except OSError:
|
22 |
-
# If not installed, download the model
|
23 |
-
subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"], check=True)
|
24 |
-
nlp = spacy.load("en_core_web_sm")
|
25 |
-
return nlp
|
26 |
-
|
27 |
-
# Load spaCy model (ensure it is downloaded)
|
28 |
-
nlp = download_spacy_model()
|
29 |
-
|
30 |
-
# Initialize Gemini Flash for prompt engineering (if available)
|
31 |
prompt_engineer = GeminiFlash()
|
32 |
|
33 |
# Streamlit Interface
|
@@ -61,10 +50,9 @@ if job_description:
|
|
61 |
# Display preprocessed job description
|
62 |
st.text_area("Processed Job Description", preprocessed_job_description)
|
63 |
|
64 |
-
# Step 3: Named Entity Recognition (NER) on Resume
|
65 |
if resume_text:
|
66 |
-
|
67 |
-
entities = [(ent.text, ent.label_) for ent in doc.ents]
|
68 |
|
69 |
# Display extracted entities
|
70 |
st.subheader("Named Entities from Resume")
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import subprocess
|
3 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
|
|
6 |
import nltk
|
7 |
from nltk.corpus import stopwords
|
8 |
from nltk.tokenize import word_tokenize
|
9 |
+
from transformers import pipeline
|
10 |
from gemini_flash import GeminiFlash # Adjust if Gemini Flash is available
|
11 |
|
12 |
# Ensure that NLTK's stopwords are available
|
13 |
nltk.download('punkt')
|
14 |
nltk.download('stopwords')
|
15 |
|
16 |
+
# Initialize Hugging Face NER pipeline
|
17 |
+
ner_model = pipeline("ner", model="dbmdz/bert-large-cased-finetuned-conll03-english")
|
18 |
+
|
19 |
+
# Initialize Gemini Flash for prompt engineering
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
prompt_engineer = GeminiFlash()
|
21 |
|
22 |
# Streamlit Interface
|
|
|
50 |
# Display preprocessed job description
|
51 |
st.text_area("Processed Job Description", preprocessed_job_description)
|
52 |
|
53 |
+
# Step 3: Named Entity Recognition (NER) on Resume using Hugging Face Transformers
|
54 |
if resume_text:
|
55 |
+
entities = ner_model(resume_text)
|
|
|
56 |
|
57 |
# Display extracted entities
|
58 |
st.subheader("Named Entities from Resume")
|