Spaces:
Sleeping
Sleeping
File size: 2,653 Bytes
25f7b33 41f04c5 1a5ad25 25f7b33 a93fdf5 112a42c 25f7b33 41f04c5 1a5ad25 25f7b33 2ce35d5 25f7b33 112a42c 25f7b33 112a42c 25f7b33 2ce35d5 25f7b33 b294e57 25f7b33 cb63b6d 25f7b33 |
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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
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 suggest_projects(skills, roles, topics, level, difficulty,model, domain, industry):
prompt = f"""
Based on the following information, suggest relevant projects:
- Skills: {skills}
- Roles: {roles}
- Topics: {topics}
- Level of Understanding: {level}
- Difficulty: {difficulty}
"""
if domain:
prompt += f"\n- Domain: {domain}"
if industry:
prompt += f"\n- Industry: {industry}"
prompt += "\n\nSuggested Projects:"
if model == "Open AI":
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
projects = llm(prompt)
elif model == "Gemini":
llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
projects = llm.invoke(prompt)
projects = projects.content
return projects
def app():
st.title("Project Suggestions")
if 'analysis' in st.session_state:
analysis = st.session_state['analysis']
st.header("Select AI:")
model = st.radio("Model", [ "Gemini","Open AI",])
st.write("Selected option:", model)
st.write("Job Description Analysis:")
st.text(analysis)
# Parse the analysis (assuming it returns JSON-like structure)
analysis_data = eval(analysis) # Convert string to dictionary
# Extract the details from analysis
skills = analysis_data.get("Skills", "")
roles = analysis_data.get("Roles", "")
topics = analysis_data.get("Topics", "")
level = analysis_data.get("Level of Understanding", "")
difficulty = analysis_data.get("Difficulty", "")
domain = analysis_data.get("domain", "")
industry = analysis_data.get("industry", "")
# Optional fields for domain and industry
# domain = st.text_input("Optional: Domain")
# industry = st.text_input("Optional: Industry")
# Suggest projects based on analysis
if st.button("Suggest Projects"):
projects = suggest_projects(skills, roles, topics, level, difficulty,model, domain, industry)
st.write("Suggested Projects:")
st.text(projects)
st.session_state['projects'] = projects.split('\n')
else:
st.error("Please go to the Job Description Analysis page first to analyze a job description.")
|