Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import google.generativeai as gemini_pro
|
3 |
+
import pandas as pd
|
4 |
+
from io import StringIO
|
5 |
+
|
6 |
+
# Initialize Google Generative AI Gemini-pro model
|
7 |
+
gemini_pro.initialize(api_key='YOUR_GOOGLE_API_KEY')
|
8 |
+
|
9 |
+
def analyze_resume(resume_text):
|
10 |
+
# Using the Gemini-pro model to analyze the resume
|
11 |
+
response = gemini_pro.analyze_text(resume_text)
|
12 |
+
return response
|
13 |
+
|
14 |
+
def extract_skills(resume_text):
|
15 |
+
# Extract skills from resume text
|
16 |
+
response = gemini_pro.extract_entities(resume_text, entity_type='skills')
|
17 |
+
skills = [entity['text'] for entity in response['entities']]
|
18 |
+
return skills
|
19 |
+
|
20 |
+
def match_job_description(resume_text, job_description):
|
21 |
+
# Match resume with job description
|
22 |
+
response = gemini_pro.compare_texts(resume_text, job_description)
|
23 |
+
score = response['similarity_score']
|
24 |
+
return score
|
25 |
+
|
26 |
+
# Streamlit application layout
|
27 |
+
st.title('Resume Analyzer for Recruiters')
|
28 |
+
|
29 |
+
st.header('Upload Resume')
|
30 |
+
uploaded_file = st.file_uploader('Choose a file', type=['pdf', 'docx', 'txt'])
|
31 |
+
|
32 |
+
if uploaded_file is not None:
|
33 |
+
# Extract text from uploaded file
|
34 |
+
stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
35 |
+
resume_text = stringio.read()
|
36 |
+
|
37 |
+
st.subheader('Resume Text')
|
38 |
+
st.write(resume_text)
|
39 |
+
|
40 |
+
st.subheader('Analyze Resume')
|
41 |
+
if st.button('Analyze'):
|
42 |
+
analysis_result = analyze_resume(resume_text)
|
43 |
+
st.write('Analysis Result:', analysis_result)
|
44 |
+
|
45 |
+
st.subheader('Extract Skills')
|
46 |
+
if st.button('Extract Skills'):
|
47 |
+
skills = extract_skills(resume_text)
|
48 |
+
st.write('Skills:', skills)
|
49 |
+
|
50 |
+
st.subheader('Match with Job Description')
|
51 |
+
job_description = st.text_area('Enter Job Description')
|
52 |
+
if st.button('Match'):
|
53 |
+
score = match_job_description(resume_text, job_description)
|
54 |
+
st.write('Match Score:', score)
|
55 |
+
|
56 |
+
st.sidebar.header('About')
|
57 |
+
st.sidebar.write("""
|
58 |
+
This application uses the Google Generative AI Gemini-pro model to analyze resumes, extract key skills, and match resumes with job descriptions. It helps recruiters quickly evaluate candidates and streamline the recruitment process.
|
59 |
+
""")
|