Spaces:
Sleeping
Sleeping
File size: 4,522 Bytes
ab0acc1 3f48abd 9f7f64e 3f48abd 9f7f64e 3f48abd 9f7f64e 3f48abd 7a90fa7 ab0acc1 3f48abd ab0acc1 3f48abd ab0acc1 3f48abd ab0acc1 3f48abd ab0acc1 3f48abd ab0acc1 3f48abd ab0acc1 3f48abd 7a90fa7 ab0acc1 7a90fa7 ab0acc1 3f48abd | 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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | import streamlit as st
from langchain_google_genai import ChatGoogleGenerativeAI
from datetime import datetime
# Custom CSS for styling
st.markdown("""
<style>
/* Style the title */
.stApp {
background-color: #8182ae ;
font-family: 'Arial', sans-serif;
}
.stTitle {
color: #2c3e50;
font-size: 32px;
font-weight: bold;
text-align: center;
margin-bottom: 20px;
}
/* Style the buttons and forms */
.stButton > button {
background-color: #d91515 ;
color: white;
padding: 10px 20px;
border-radius: 5px;
border: none;
font-weight: bold;
}
.stForm {
background-color: #ecf0f1;
}
/* Style the sidebar */
.stSidebar > div {
background-color: #8182ae;
padding: 15px;
border-radius: 10px;
}
.stSidebar > div > h1 {
color: #2c3e50;
}
</style>
""", unsafe_allow_html=True)
st.markdown("<h1 class='stTitle'>Prepare Smarter, Ace the Interview!</h1>", unsafe_allow_html=True)
# Function to generate interview questions
def generate_questions(role, topic, difficulty, num_questions):
prompt = (
f"Generate {num_questions} {difficulty} interview questions for a {role} role "
f"focused on {topic}."
)
llm = ChatGoogleGenerativeAI(model='gemini-pro', google_api_key=st.secrets["GOOGLE_API_KEY"])
answers = llm.invoke(prompt)
return answers.content if answers else "No questions generated."
# Function to analyze responses and give feedback
def analyze_responses(response):
prompt = (
f"Provide constructive feedback on the following interview response:\n\n{response}"
)
llm = ChatGoogleGenerativeAI(model='gemini-pro', google_api_key=st.secrets["GOOGLE_API_KEY"])
feedback = llm.invoke(prompt)
return feedback.content if feedback else "No feedback available."
# Function to provide general and specific interview tips
def provide_tips(role=None):
prompt = "Share general interview tips."
if role:
prompt += f" Provide specific tips for a {role} role."
llm = ChatGoogleGenerativeAI(model='gemini-pro', google_api_key=st.secrets["GOOGLE_API_KEY"])
tips = llm.invoke(prompt)
return tips.content if tips else "No tips available."
# Interface for generating questions
with st.form('question_form', clear_on_submit=True):
st.markdown("<div class='stForm'>", unsafe_allow_html=True)
role = st.selectbox('Select Role', ['Software Developer', 'Data Analyst', 'Marketing Manager'])
topic = st.selectbox('Select Topic', ['Behavioral', 'Technical', 'Situational'])
difficulty = st.selectbox('Select Difficulty Level', ['Easy', 'Medium', 'Hard'])
num_questions = st.slider('Number of Questions', 1, 10, 5)
question_submitted = st.form_submit_button('Generate Questions')
if question_submitted:
questions = generate_questions(role, topic, difficulty, num_questions)
st.info(questions)
st.markdown("</div>", unsafe_allow_html=True)
# Interface for feedback on responses
with st.form('feedback_form', clear_on_submit=True):
st.markdown("<div class='stForm'>", unsafe_allow_html=True)
response = st.text_area('Type your interview response')
feedback_submitted = st.form_submit_button('Get Feedback')
if feedback_submitted and response:
feedback = analyze_responses(response)
st.info(feedback)
st.markdown("</div>", unsafe_allow_html=True)
# Interface for interview tips
with st.form('tips_form', clear_on_submit=True):
st.markdown("<div class='stForm'>", unsafe_allow_html=True)
role_for_tips = st.selectbox('Select Role for Tips', ['', 'Software Developer', 'Data Analyst', 'Marketing Manager'])
tips_submitted = st.form_submit_button('Get Tips')
if tips_submitted:
tips = provide_tips(role_for_tips if role_for_tips else None)
st.info(tips)
st.markdown("</div>", unsafe_allow_html=True)
# Sidebar for mock interview scheduling and resources
st.sidebar.header(" Book Your Interview Slot")
st.sidebar.write("Book a Practice Interview with the Bot")
mock_date = st.sidebar.date_input("Select Date", datetime.now())
mock_time = st.sidebar.time_input("Select Time", datetime.now().time())
st.sidebar.button("Schedule Interview", on_click=lambda: st.sidebar.write("Interview is Booked!"))
st.sidebar.header("Engagement Metrics and Resources")
st.sidebar.write("Track your progress over time and connect with resources.")
|