VivekDS's picture
Update app4.py
1c637c3 verified
raw
history blame contribute delete
No virus
1.86 kB
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()