File size: 1,862 Bytes
a399796
 
 
 
 
 
 
 
 
1c637c3
a399796
 
 
9dbf6f0
a399796
e857a66
 
a399796
 
6c9d94f
a399796
 
 
 
 
 
 
e857a66
a399796
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from langchain_community.llms import OpenAI
from langchain_google_genai import ChatGoogleGenerativeAI
st.set_page_config(layout="wide")


# Function to handle AI invocation and response
def analyze_job_description(topic, model ):
    prompt = (
        f"As an HR Manager, I need you to analyze the following job description and identify the key technical skills, non technical skills or soft skills , further divide it nice-to-have skills, must-have skills,  required for the role: {topic}. "
        "The post should be concise, informative, and suitable for a professional audience. "
        "List top 5 points for technical skills, nice-to-have skills, must-have skills, and soft skills required for the role."
    )
        
    if model == "Open AI":
        # llm = OpenAI(openai_api_key=st.secrets["OPENAI_API_KEY"])
        response ="Whoops! Looks like someone's got champagne tastes on a lemonade budget. How about we explore those other options for now? 😉"
        return response
    elif model == "Gemini":
        llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
        result = llm.invoke(prompt)
        return result.content

def main():
    st.title("JD Analysis")
    # Radio selection for AI model
    st.header("Select AI:")
    model = st.radio("Model", [ "Gemini","Open AI",])
    st.write("Selected option:", model)
    
    # Text area for job description input
    with st.form("my_form"):
        topic = st.text_area("Copy Paste the JD here:")
        submitted = st.form_submit_button("Analyze Now")
        if submitted and topic:
            result = analyze_job_description(topic, model )
            st.info(result)
        elif submitted and not topic:
            st.error("Please enter a JD details to analyze.")


if __name__ == "__main__":
    main()