File size: 1,256 Bytes
d340145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from resume_parser import extract_resume_data
from gemini_api import authenticate_gemini, generate_summary

# Your hardcoded API key (You can also set this in environment variables)
api_key = "AIzaSyCG-qpFRqJc0QOJT-AcAaO5XIEdE-nk3Tc"

def main():
    st.title("Resume Analyzer")
    st.write("Upload a resume to extract information")

    uploaded_file = st.file_uploader("Choose a PDF or DOCX file", type=["pdf", "docx", "doc"])

    if uploaded_file is not None:
        try:
            # Authenticate with Google Gemini API
            model = authenticate_gemini(api_key)
            if model is None:
                return

            # Extract resume data
            extracted_data, resume_text = extract_resume_data(uploaded_file)

            # Generate summary using Gemini API
            summary = generate_summary(resume_text, model)

            # Display results
            st.subheader("Extracted Information")
            for key, value in extracted_data.items():
                st.write(f"*{key}:* {value}")

            st.subheader("Generated Summary")
            st.write(summary)

        except Exception as e:
            st.error(f"Error during processing: {e}")

if __name__ == "__main__":
    main()