|
import streamlit as st |
|
from PyPDF2 import PdfReader |
|
import pandas as pd |
|
from sklearn.feature_extraction.text import TfidfVectorizer |
|
|
|
from sklearn.metrics.pairwise import cosine_similarity |
|
|
|
import streamlit as st |
|
from PyPDF2 import PdfReader |
|
import pandas as pd |
|
from sklearn.feature_extraction.text import TfidfVectorizer |
|
from sklearn.metrics.pairwise import cosine_similarity |
|
from gliner import GLiNER |
|
|
|
|
|
import streamlit as st |
|
import pandas as pd |
|
from PyPDF2 import PdfReader |
|
from gliner import GLiNER |
|
|
|
import streamlit as st |
|
import pandas as pd |
|
from PyPDF2 import PdfReader |
|
from sklearn.feature_extraction.text import TfidfVectorizer |
|
from sklearn.metrics.pairwise import cosine_similarity |
|
import tempfile |
|
|
|
with st.sidebar: |
|
st.button("DEMO APP", type="primary") |
|
|
|
|
|
expander = st.expander("**Important notes on the YouTube Comments Sentiment Analysis App**") |
|
expander.write(''' |
|
|
|
|
|
**Supported File Formats** |
|
This app accepts files in .pdf formats. |
|
|
|
**How to Use** |
|
Upload your file first. Then, click the 'Results' button. |
|
|
|
**Usage Limits** |
|
You can request results up to 5 times. |
|
|
|
**Subscription Management** |
|
This demo app offers a one-day subscription, expiring after 24 hours. If you are interested in building your own Named Entity Recognition (NER) Web App, we invite you to explore our NLP Web App Store on our website. You can select your desired features, place your order, and we will deliver your custom app within five business days. If you wish to delete your Account with us, please contact us at [email protected] |
|
|
|
**Authorization** |
|
For security purposes, your authorization access expires hourly. To restore access, click the "Request Authorization" button. |
|
|
|
**Customization** |
|
To change the app's background color to white or black, click the three-dot menu on the right-hand side of your app, go to Settings and then Choose app theme, colors and fonts. |
|
|
|
**File Handling and Errors** |
|
The app may display an error message if your file is corrupt, or has other errors. |
|
|
|
|
|
For any errors or inquiries, please contact us at [email protected] |
|
|
|
|
|
|
|
''') |
|
|
|
|
|
|
|
st.subheader("AI Resume Analysis based on keywords", divider="red") |
|
|
|
txt = st.text_area("Job description", key = "text 1") |
|
job = pd.Series(txt, name="Text") |
|
st.dataframe(job) |
|
|
|
uploaded_files = st.file_uploader( |
|
"Choose a CSV file", accept_multiple_files=True, type = "pdf", key = "candidate 1" |
|
) |
|
for uploaded_file in uploaded_files: |
|
pdf_reader = PdfReader(uploaded_file) |
|
text_data = "" |
|
for page in pdf_reader.pages: |
|
text_data += page.extract_text() |
|
data = pd.Series(text_data, name = 'Text') |
|
st.dataframe(data) |
|
st.text_area("Extracted Text", data, height=200) |
|
frames = [job, data] |
|
result = pd.concat(frames) |
|
st.dataframe(result) |
|
|
|
model = GLiNER.from_pretrained("xomad/gliner-model-merge-large-v1.0") |
|
labels = ["person", "country", "city", "organization", "date", "money", "percent value", "position"] |
|
entities = model.predict_entities(text_data, labels) |
|
df = pd.DataFrame(entities) |
|
st.dataframe(entities) |
|
st.dataframe(df) |
|
|
|
import plotly.express as px |
|
fig = px.treemap(entities, path=[px.Constant("all"), 'text', 'label'], |
|
values='score', color='label') |
|
fig.update_layout(margin = dict(t=50, l=25, r=25, b=25)) |
|
st.plotly_chart(fig) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vectorizer = TfidfVectorizer() |
|
tfidf_matrix = vectorizer.fit_transform(result) |
|
tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns=vectorizer.get_feature_names_out()) |
|
st.subheader("TF-IDF Values:") |
|
st.dataframe(tfidf_df) |
|
|
|
cosine_sim_matrix = cosine_similarity(tfidf_matrix) |
|
cosine_sim_df = pd.DataFrame(cosine_sim_matrix) |
|
st.subheader("Cosine Similarity Matrix:") |
|
st.dataframe(cosine_sim_df) |
|
|
|
import plotly.express as px |
|
st.subheader("A score closer to 1 means closer match") |
|
|
|
fig = px.imshow(cosine_sim_df, text_auto=True, labels=dict(x="Cosine similarity", y="Text", color="Productivity"), |
|
x=['text1', 'Jon Description'], |
|
y=['text1', 'Job Description']) |
|
st.plotly_chart(fig) |
|
|
|
st.subheader("Cosine Similarity Scores (Job Description vs. Resumes):") |
|
for i, similarity_score in enumerate(cosine_sim_matrix[0][1:]): |
|
st.write(f"Similarity with Candidate Profile {i + 1}: {similarity_score:.4f}") |
|
|
|
|
|
st.divider() |
|
|
|
txt = st.text_area("Job description", key = "text 2") |
|
job = pd.Series(txt, name="Text") |
|
st.dataframe(job) |
|
|
|
uploaded_files = st.file_uploader( |
|
"Choose a CSV file", accept_multiple_files=True, type = "pdf", key = "candidate 2" |
|
) |
|
for uploaded_file in uploaded_files: |
|
pdf_reader = PdfReader(uploaded_file) |
|
text_data = "" |
|
for page in pdf_reader.pages: |
|
text_data += page.extract_text() |
|
data = pd.Series(text_data, name = 'Text') |
|
st.dataframe(data) |
|
frames = [job, data] |
|
result = pd.concat(frames) |
|
st.dataframe(result) |
|
|