File size: 2,098 Bytes
63c0ac7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import streamlit as st
import google.generativeai as gemini_pro
import pandas as pd
from io import StringIO

# Initialize Google Generative AI Gemini-pro model
gemini_pro.initialize(api_key='YOUR_GOOGLE_API_KEY')

def analyze_resume(resume_text):
    # Using the Gemini-pro model to analyze the resume
    response = gemini_pro.analyze_text(resume_text)
    return response

def extract_skills(resume_text):
    # Extract skills from resume text
    response = gemini_pro.extract_entities(resume_text, entity_type='skills')
    skills = [entity['text'] for entity in response['entities']]
    return skills

def match_job_description(resume_text, job_description):
    # Match resume with job description
    response = gemini_pro.compare_texts(resume_text, job_description)
    score = response['similarity_score']
    return score

# Streamlit application layout
st.title('Resume Analyzer for Recruiters')

st.header('Upload Resume')
uploaded_file = st.file_uploader('Choose a file', type=['pdf', 'docx', 'txt'])

if uploaded_file is not None:
    # Extract text from uploaded file
    stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
    resume_text = stringio.read()

    st.subheader('Resume Text')
    st.write(resume_text)

    st.subheader('Analyze Resume')
    if st.button('Analyze'):
        analysis_result = analyze_resume(resume_text)
        st.write('Analysis Result:', analysis_result)

    st.subheader('Extract Skills')
    if st.button('Extract Skills'):
        skills = extract_skills(resume_text)
        st.write('Skills:', skills)

    st.subheader('Match with Job Description')
    job_description = st.text_area('Enter Job Description')
    if st.button('Match'):
        score = match_job_description(resume_text, job_description)
        st.write('Match Score:', score)

st.sidebar.header('About')
st.sidebar.write("""
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.
""")