Spaces:
Sleeping
Sleeping
updated with gemini and new anthropic models too
Browse files- app.py +18 -16
- resume_field_extraction.py +40 -0
- resume_helpers.py +5 -3
- resume_template.py +0 -5
app.py
CHANGED
@@ -1,22 +1,23 @@
|
|
1 |
from dotenv import load_dotenv
|
2 |
-
import io
|
3 |
import streamlit as st
|
4 |
-
import streamlit.components.v1 as components
|
5 |
-
import base64
|
6 |
|
7 |
-
from langchain.prompts import PromptTemplate
|
8 |
-
from langchain_core.output_parsers import PydanticOutputParser
|
9 |
from langchain_anthropic import ChatAnthropic
|
10 |
from langchain_openai import ChatOpenAI
|
11 |
from langchain_groq import ChatGroq
|
|
|
12 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
13 |
-
from langchain_core.exceptions import OutputParserException
|
14 |
-
from pydantic import ValidationError
|
15 |
-
from langchain_core.pydantic_v1 import BaseModel, Field
|
16 |
-
from resume_template import Resume
|
17 |
-
from json import JSONDecodeError
|
18 |
-
import PyPDF2
|
19 |
-
import json
|
20 |
import time
|
21 |
import os
|
22 |
|
@@ -31,7 +32,6 @@ os.environ['LANGCHAIN_PROJECT'] = 'Resume_Project'
|
|
31 |
|
32 |
load_dotenv()
|
33 |
|
34 |
-
|
35 |
st.set_page_config(layout="wide")
|
36 |
|
37 |
st.title("Resume Parser")
|
@@ -52,13 +52,15 @@ with col2:
|
|
52 |
""")
|
53 |
|
54 |
llm_dict = {
|
55 |
-
"GPT 3.5 turbo": ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo"),
|
56 |
-
"
|
|
|
57 |
"Llama 3 8b": ChatGroq(model_name="llama3-8b-8192"),
|
58 |
"Llama 3 70b": ChatGroq(model_name="llama3-70b-8192"),
|
59 |
"Gemma 7b": ChatGroq(model_name="gemma-7b-it"),
|
60 |
"Mixtral 8x7b": ChatGroq(model_name="mixtral-8x7b-32768"),
|
61 |
-
|
|
|
62 |
}
|
63 |
|
64 |
uploaded_file = st.file_uploader("Upload a PDF file", type="pdf")
|
|
|
1 |
from dotenv import load_dotenv
|
2 |
+
# import io
|
3 |
import streamlit as st
|
4 |
+
# import streamlit.components.v1 as components
|
5 |
+
# import base64
|
6 |
|
7 |
+
# from langchain.prompts import PromptTemplate
|
8 |
+
# from langchain_core.output_parsers import PydanticOutputParser
|
9 |
from langchain_anthropic import ChatAnthropic
|
10 |
from langchain_openai import ChatOpenAI
|
11 |
from langchain_groq import ChatGroq
|
12 |
+
# from langchain_google_genai import ChatGoogleGenerativeAI
|
13 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
14 |
+
# from langchain_core.exceptions import OutputParserException
|
15 |
+
# from pydantic import ValidationError
|
16 |
+
# from langchain_core.pydantic_v1 import BaseModel, Field
|
17 |
+
# from resume_template import Resume
|
18 |
+
# from json import JSONDecodeError
|
19 |
+
# import PyPDF2
|
20 |
+
# import json
|
21 |
import time
|
22 |
import os
|
23 |
|
|
|
32 |
|
33 |
load_dotenv()
|
34 |
|
|
|
35 |
st.set_page_config(layout="wide")
|
36 |
|
37 |
st.title("Resume Parser")
|
|
|
52 |
""")
|
53 |
|
54 |
llm_dict = {
|
55 |
+
"GPT 3.5 turbo": ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-0125"),
|
56 |
+
"GPT 4o": ChatOpenAI(temperature=0, model_name="gpt-4o"),
|
57 |
+
"Anthropic 3.5 Sonnet": ChatAnthropic(model="claude-3-5-sonnet-20240620"),
|
58 |
"Llama 3 8b": ChatGroq(model_name="llama3-8b-8192"),
|
59 |
"Llama 3 70b": ChatGroq(model_name="llama3-70b-8192"),
|
60 |
"Gemma 7b": ChatGroq(model_name="gemma-7b-it"),
|
61 |
"Mixtral 8x7b": ChatGroq(model_name="mixtral-8x7b-32768"),
|
62 |
+
"Gemini 1.5 Pro": ChatGoogleGenerativeAI(model="gemini-1.5-pro"),
|
63 |
+
"Gemini 1.5 Flash": ChatGoogleGenerativeAI(model="gemini-1.5-flash"),
|
64 |
}
|
65 |
|
66 |
uploaded_file = st.file_uploader("Upload a PDF file", type="pdf")
|
resume_field_extraction.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
|
3 |
+
from langchain.chains import create_structured_output_runnable
|
4 |
+
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
5 |
+
from langchain_core.pydantic_v1 import BaseModel, Field
|
6 |
+
from langchain_openai import ChatOpenAI
|
7 |
+
|
8 |
+
class CompanyOverview(BaseModel):
|
9 |
+
"""Information about the company offering the job."""
|
10 |
+
about: Optional[str] = Field(..., description="Brief description of the company")
|
11 |
+
mission_and_values: Optional[str] = Field(None, description="Company mission and values")
|
12 |
+
size_and_locations: Optional[str] = Field(None, description="Company size and locations")
|
13 |
+
|
14 |
+
class RoleSummary(BaseModel):
|
15 |
+
"""Summary information about the job role."""
|
16 |
+
title: str = Field(..., description="Job title")
|
17 |
+
team_or_department: Optional[str] = Field(None, description="Team or department the role belongs to")
|
18 |
+
role_type: Optional[str] = Field(..., description="Type of role (full-time, part-time, contract, etc.)")
|
19 |
+
location: Optional[str] = Field(..., description="Location (on-site, remote, hybrid)")
|
20 |
+
|
21 |
+
class ResponsibilitiesAndQualifications(BaseModel):
|
22 |
+
"""Key responsibilities and qualifications for the job role."""
|
23 |
+
responsibilities: List[str] = Field(..., description="Key responsibilities of the role")
|
24 |
+
projects_and_problems: Optional[str] = Field(None, description="Types of projects and problems to be worked on")
|
25 |
+
required_skills_and_experience: List[str] = Field(..., description="Required skills and experience for the role")
|
26 |
+
preferred_skills_and_experience: Optional[List[str]] = Field(None, description="Preferred skills and experience for the role")
|
27 |
+
|
28 |
+
class CompensationAndBenefits(BaseModel):
|
29 |
+
"""Compensation and benefits offered for the job role."""
|
30 |
+
salary_or_pay_range: Optional[str] = Field(None, description="Salary or hourly pay range")
|
31 |
+
bonus_and_equity: Optional[str] = Field(None, description="Bonus and equity compensation")
|
32 |
+
benefits: Optional[List[str]] = Field(None, description="Benefits (health insurance, retirement plans, PTO, etc.)")
|
33 |
+
perks: Optional[List[str]] = Field(None, description="Perks (food, commuter benefits, learning stipend, etc.)")
|
34 |
+
|
35 |
+
class JobDescription(BaseModel):
|
36 |
+
"""Extracted information from a job description."""
|
37 |
+
company_overview: CompanyOverview
|
38 |
+
role_summary: RoleSummary
|
39 |
+
responsibilities_and_qualifications: ResponsibilitiesAndQualifications
|
40 |
+
compensation_and_benefits: CompensationAndBenefits
|
resume_helpers.py
CHANGED
@@ -29,13 +29,15 @@ os.environ['LANGCHAIN_PROJECT'] = 'Resume_Project'
|
|
29 |
|
30 |
load_dotenv()
|
31 |
llm_dict = {
|
32 |
-
"GPT 3.5 turbo": ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo"),
|
33 |
-
"
|
|
|
34 |
"Llama 3 8b": ChatGroq(model_name="llama3-8b-8192"),
|
35 |
"Llama 3 70b": ChatGroq(model_name="llama3-70b-8192"),
|
36 |
"Gemma 7b": ChatGroq(model_name="gemma-7b-it"),
|
37 |
"Mixtral 8x7b": ChatGroq(model_name="mixtral-8x7b-32768"),
|
38 |
-
|
|
|
39 |
}
|
40 |
def pdf_to_string(file):
|
41 |
"""
|
|
|
29 |
|
30 |
load_dotenv()
|
31 |
llm_dict = {
|
32 |
+
"GPT 3.5 turbo": ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-0125"),
|
33 |
+
"GPT 4o": ChatOpenAI(temperature=0, model_name="gpt-4o"),
|
34 |
+
"Anthropic 3.5 Sonnet": ChatAnthropic(model="claude-3-5-sonnet-20240620"),
|
35 |
"Llama 3 8b": ChatGroq(model_name="llama3-8b-8192"),
|
36 |
"Llama 3 70b": ChatGroq(model_name="llama3-70b-8192"),
|
37 |
"Gemma 7b": ChatGroq(model_name="gemma-7b-it"),
|
38 |
"Mixtral 8x7b": ChatGroq(model_name="mixtral-8x7b-32768"),
|
39 |
+
"Gemini 1.5 Pro": ChatGoogleGenerativeAI(model="gemini-1.5-pro"),
|
40 |
+
"Gemini 1.5 Flash": ChatGoogleGenerativeAI(model="gemini-1.5-flash"),
|
41 |
}
|
42 |
def pdf_to_string(file):
|
43 |
"""
|
resume_template.py
CHANGED
@@ -32,11 +32,6 @@ class Project(BaseModel):
|
|
32 |
technologies: Optional[str] = None
|
33 |
role: Optional[str] = None
|
34 |
|
35 |
-
# class Certification(BaseModel):
|
36 |
-
# title: Optional[str] = None
|
37 |
-
# certifying_body: Optional[str] = None
|
38 |
-
# date: Optional[str] = None
|
39 |
-
|
40 |
class Publication(BaseModel):
|
41 |
title: Optional[str] = None
|
42 |
co_authors: List[str] = []
|
|
|
32 |
technologies: Optional[str] = None
|
33 |
role: Optional[str] = None
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
class Publication(BaseModel):
|
36 |
title: Optional[str] = None
|
37 |
co_authors: List[str] = []
|