Spaces:
Sleeping
Sleeping
File size: 2,238 Bytes
483966b |
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 |
import streamlit as st
from langchain.llms import GooglePalm
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
from langchain.chains import SequentialChain
# Function to generate skills and companies based on the job role
def generate_skills_and_companies(job_role):
# Initialize Google's Palm LLM
llm = GooglePalm(google_api_key='AIzaSyAA28rGYJnOsGasVGEQ-dJRHXqLNTVEQz4', temperature=0) # Replace with your Google API Key
# Chain 1: This chain is for Job role
prompt_template_name = PromptTemplate(
input_variables=['job_role'],
template="""I want to apply for a {job_role} role. Please help me with the desired skills and ensure you are
giving correct skills as it is critical"""
)
skills_chain = LLMChain(llm=llm, prompt=prompt_template_name, output_key="skills")
# Chain 2: This is for companies
prompt_template_items = PromptTemplate(
input_variables=['companies'],
template="""Suggest some companies to apply for {job_role}. Return it as a comma separated string"""
)
companies_chain = LLMChain(llm=llm, prompt=prompt_template_items, output_key="companies")
chain = SequentialChain(
chains=[skills_chain, companies_chain],
input_variables=['job_role'],
output_variables=['skills', "companies"]
)
response = chain({'job_role': job_role})
return response
# Streamlit app
st.title("Skills and Companies Recommendation App")
st.subheader("Developed by Mujeeb")
# Sidebar with image and additional options
st.sidebar.image("odinschool1.jpg", use_column_width=True)
# Main content area
job_role = st.text_input("Enter the job role:")
if st.button("Generate"):
with st.spinner("Generating recommendations..."):
output = generate_skills_and_companies(job_role)
if output:
st.subheader("Skills:")
skills = output['skills'].split('\n')
for skill in skills:
skill = skill.strip('* ').strip()
st.write(skill)
st.subheader("Companies:")
companies = output['companies'].split('\n')
for company in companies:
company = company.strip('* ').strip()
st.write(company)
|