Spaces:
Sleeping
Sleeping
File size: 1,791 Bytes
e8de125 0ea37df e8de125 cd68877 e8de125 a32a600 10c2260 a32a600 e8de125 a32a600 |
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 60 61 62 63 64 65 66 67 68 |
import streamlit as st
import os
from dotenv import load_dotenv
from langchain_community.llms import OpenAI
from langchain_google_genai import ChatGoogleGenerativeAI
# Load environment variables
load_dotenv()
def analyze_job_description(job_description,model):
prompt = f"""
Analyze the following job description and extract the following information:
- Skills
- Roles
- Topics
- Level of Understanding
- Difficulty
- Domain of company
- Industry of company
Job Description:
{job_description}
.provide the answer in json format
"""
if model == "Open AI":
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
analysis = llm(prompt)
elif model == "Gemini":
llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
analysis = llm.invoke(prompt)
analysis = analysis.content
return analysis
def app():
st.title("Job Description Analysis")
st.header("Select AI:")
model = st.radio("Model", [ "Gemini","Open AI",])
st.write("Selected option:", model)
# Input: Job description
job_description = st.text_area("Enter Job Description:")
# Analyze button
if st.button("Analyze"):
if job_description:
# Use the model to analyze the job description
analysis = analyze_job_description(job_description,model)
st.write("Analysis:")
st.text(analysis)
# Store analysis in session state for use in Project Suggestions page
st.session_state['analysis'] = analysis
model = model
else:
st.error("Please enter a job description.")
|