AnishaG0201 commited on
Commit
e8de125
·
verified ·
1 Parent(s): 6a5c5fd

Update Job_description_analysis.py

Browse files
Files changed (1) hide show
  1. Job_description_analysis.py +56 -0
Job_description_analysis.py CHANGED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+ from dotenv import load_dotenv
4
+ from langchain_community.llms import OpenAI
5
+ from langchain_google_genai import ChatGoogleGenerativeAI
6
+
7
+ # Load environment variables
8
+ load_dotenv()
9
+
10
+
11
+ def analyze_job_description(job_description,model):
12
+ prompt = f"""
13
+ Analyze the following job description and extract the following information:
14
+ - Skills
15
+ - Roles
16
+ - Topics
17
+ - Level of Understanding
18
+ - Difficulty
19
+
20
+ Job Description:
21
+ {job_description}
22
+ """
23
+
24
+
25
+ if model == "Open AI":
26
+ llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
27
+ analysis = llm(prompt)
28
+
29
+
30
+ elif model == "Gemini":
31
+ llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
32
+ analysis = llm.invoke(prompt)
33
+ analysis = analysis.content
34
+
35
+
36
+ return analysis
37
+
38
+ def app():
39
+ st.title("Job Description Analysis")
40
+
41
+ st.header("Select AI:")
42
+ model = st.radio("Model", [ "Gemini","Open AI",])
43
+ st.write("Selected option:", model)
44
+
45
+ # Input: Job description
46
+ job_description = st.text_area("Enter Job Description:")
47
+
48
+ # Analyze button
49
+ if st.button("Analyze"):
50
+ if job_description:
51
+ # Use the model to analyze the job description
52
+ analysis = analyze_job_description(job_description,model)
53
+ st.write("Analysis:")
54
+ st.text(analysis)
55
+ else:
56
+ st.error("Please enter a job description.")