import streamlit as st
from langchain_google_genai import ChatGoogleGenerativeAI
from datetime import datetime
# Custom CSS for styling
st.markdown("""
""", unsafe_allow_html=True)
st.markdown("
Prepare Smarter, Ace the Interview!
", 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("", 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("
", unsafe_allow_html=True)
# Interface for feedback on responses
with st.form('feedback_form', clear_on_submit=True):
st.markdown("", 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("
", unsafe_allow_html=True)
# Interface for interview tips
with st.form('tips_form', clear_on_submit=True):
st.markdown("", 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("
", 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.")