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.")