Shweta7171 commited on
Commit
628b3fb
·
verified ·
1 Parent(s): 5b0d2e4

Upload app4.py

Browse files
Files changed (1) hide show
  1. app4.py +43 -0
app4.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from langchain_community.llms import OpenAI
3
+ from langchain_google_genai import ChatGoogleGenerativeAI
4
+ st.set_page_config(layout="wide")
5
+
6
+
7
+ # Function to handle AI invocation and response
8
+ def analyze_job_description(topic, model ):
9
+ prompt = (
10
+ 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}. "
11
+ "The post should be concise, informative, and suitable for a professional audience. "
12
+ "List top 5 points for technical skills, nice-to-have skills, must-have skills, and soft skills required for the role."
13
+ )
14
+
15
+ if model == "Open AI":
16
+ # llm = OpenAI(openai_api_key=st.secrets["OPENAI_API_KEY"])
17
+ response ="Whoops! Looks like someone's got champagne tastes on a lemonade budget. How about we explore those other options for now? 😉"
18
+ return response
19
+ elif model == "Gemini":
20
+ llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
21
+ result = llm.invoke(prompt)
22
+ return result.content
23
+
24
+ def main():
25
+ st.title("JD Analysis")
26
+ # Radio selection for AI model
27
+ st.header("Select AI:")
28
+ model = st.radio("Model", [ "Gemini","Open AI",])
29
+ st.write("Selected option:", model)
30
+
31
+ # Text area for job description input
32
+ with st.form("my_form"):
33
+ topic = st.text_area("Copy Paste the JD here:")
34
+ submitted = st.form_submit_button("Analyze Now")
35
+ if submitted and topic:
36
+ result = analyze_job_description(topic, model )
37
+ st.info(result)
38
+ elif submitted and not topic:
39
+ st.error("Please enter a JD details to analyze.")
40
+
41
+
42
+ if __name__ == "__main__":
43
+ main()