Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,9 @@ progress_data = {
|
|
| 19 |
"tips_retrieved": 0
|
| 20 |
}
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
def get_llm(model_choice):
|
| 23 |
if model_choice == "Gemini":
|
| 24 |
return ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=GOOGLE_API_KEY)
|
|
@@ -78,13 +81,13 @@ def get_tips(model_choice, role):
|
|
| 78 |
else:
|
| 79 |
raise ValueError("Unsupported model choice.")
|
| 80 |
|
| 81 |
-
def start_mock_interview():
|
| 82 |
st.write("### Mock Interview Starting")
|
| 83 |
-
st.write("The mock interview is starting now. Please
|
| 84 |
-
st.write("**Interview Timer:**")
|
| 85 |
-
countdown_end = datetime.now() + timedelta(minutes=
|
| 86 |
|
| 87 |
-
# Simulate
|
| 88 |
st.markdown("""
|
| 89 |
<div style="
|
| 90 |
width: 100%;
|
|
@@ -99,10 +102,11 @@ def start_mock_interview():
|
|
| 99 |
border-radius: 8px;
|
| 100 |
border: 2px solid #2196F3;
|
| 101 |
">
|
| 102 |
-
<p>
|
| 103 |
</div>
|
| 104 |
""", unsafe_allow_html=True)
|
| 105 |
|
|
|
|
| 106 |
while datetime.now() < countdown_end:
|
| 107 |
remaining_time = countdown_end - datetime.now()
|
| 108 |
if remaining_time <= timedelta(seconds=3):
|
|
@@ -110,6 +114,11 @@ def start_mock_interview():
|
|
| 110 |
time.sleep(1)
|
| 111 |
|
| 112 |
st.write("Mock Interview Session Ended.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
progress_data["mock_interviews_taken"] += 1
|
| 114 |
|
| 115 |
def schedule_mock_interview():
|
|
@@ -117,13 +126,14 @@ def schedule_mock_interview():
|
|
| 117 |
date = st.date_input("Select Date", min_value=datetime.today())
|
| 118 |
time = st.time_input("Select Time", value=datetime.now().time())
|
| 119 |
duration = st.selectbox("Duration (Minutes)", [30, 45, 60])
|
|
|
|
| 120 |
now = datetime.now()
|
| 121 |
selected_datetime = datetime.combine(date, time)
|
| 122 |
|
| 123 |
col1, col2 = st.columns(2)
|
| 124 |
with col1:
|
| 125 |
if st.button("Start Interview Now"):
|
| 126 |
-
start_mock_interview()
|
| 127 |
|
| 128 |
with col2:
|
| 129 |
if st.button("Schedule Interview"):
|
|
@@ -148,6 +158,17 @@ def track_progress():
|
|
| 148 |
</div>
|
| 149 |
""", unsafe_allow_html=True)
|
| 150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
def connect_resources():
|
| 152 |
st.subheader("Connect with Resources")
|
| 153 |
st.write("### Articles & Books")
|
|
@@ -311,3 +332,4 @@ st.markdown("""
|
|
| 311 |
<p>© 2024 TechPrep. All rights reserved.</p>
|
| 312 |
</div>
|
| 313 |
""", unsafe_allow_html=True)
|
|
|
|
|
|
| 19 |
"tips_retrieved": 0
|
| 20 |
}
|
| 21 |
|
| 22 |
+
# Placeholder for recorded interviews
|
| 23 |
+
recorded_interviews = []
|
| 24 |
+
|
| 25 |
def get_llm(model_choice):
|
| 26 |
if model_choice == "Gemini":
|
| 27 |
return ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=GOOGLE_API_KEY)
|
|
|
|
| 81 |
else:
|
| 82 |
raise ValueError("Unsupported model choice.")
|
| 83 |
|
| 84 |
+
def start_mock_interview(interview_details):
|
| 85 |
st.write("### Mock Interview Starting")
|
| 86 |
+
st.write(f"The mock interview with the bot is starting now. Please proceed with your responses.")
|
| 87 |
+
st.write(f"**Interview Timer:**")
|
| 88 |
+
countdown_end = datetime.now() + timedelta(minutes=interview_details['duration'])
|
| 89 |
|
| 90 |
+
# Simulate interview environment
|
| 91 |
st.markdown("""
|
| 92 |
<div style="
|
| 93 |
width: 100%;
|
|
|
|
| 102 |
border-radius: 8px;
|
| 103 |
border: 2px solid #2196F3;
|
| 104 |
">
|
| 105 |
+
<p>Interview in Progress with Bot...</p>
|
| 106 |
</div>
|
| 107 |
""", unsafe_allow_html=True)
|
| 108 |
|
| 109 |
+
# Timer for the mock interview
|
| 110 |
while datetime.now() < countdown_end:
|
| 111 |
remaining_time = countdown_end - datetime.now()
|
| 112 |
if remaining_time <= timedelta(seconds=3):
|
|
|
|
| 114 |
time.sleep(1)
|
| 115 |
|
| 116 |
st.write("Mock Interview Session Ended.")
|
| 117 |
+
recorded_interviews.append({
|
| 118 |
+
"date": datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
| 119 |
+
"duration": interview_details['duration'],
|
| 120 |
+
"role": interview_details['role']
|
| 121 |
+
})
|
| 122 |
progress_data["mock_interviews_taken"] += 1
|
| 123 |
|
| 124 |
def schedule_mock_interview():
|
|
|
|
| 126 |
date = st.date_input("Select Date", min_value=datetime.today())
|
| 127 |
time = st.time_input("Select Time", value=datetime.now().time())
|
| 128 |
duration = st.selectbox("Duration (Minutes)", [30, 45, 60])
|
| 129 |
+
role = st.selectbox("Select Role", ["Software Developer", "Data Analyst", "Marketing Manager"])
|
| 130 |
now = datetime.now()
|
| 131 |
selected_datetime = datetime.combine(date, time)
|
| 132 |
|
| 133 |
col1, col2 = st.columns(2)
|
| 134 |
with col1:
|
| 135 |
if st.button("Start Interview Now"):
|
| 136 |
+
start_mock_interview({"role": role, "duration": duration})
|
| 137 |
|
| 138 |
with col2:
|
| 139 |
if st.button("Schedule Interview"):
|
|
|
|
| 158 |
</div>
|
| 159 |
""", unsafe_allow_html=True)
|
| 160 |
|
| 161 |
+
# Show recorded interviews
|
| 162 |
+
st.subheader("Recorded Mock Interviews")
|
| 163 |
+
if recorded_interviews:
|
| 164 |
+
for interview in recorded_interviews:
|
| 165 |
+
st.write(f"**Date:** {interview['date']}")
|
| 166 |
+
st.write(f"**Role:** {interview['role']}")
|
| 167 |
+
st.write(f"**Duration:** {interview['duration']} minutes")
|
| 168 |
+
st.write("---")
|
| 169 |
+
else:
|
| 170 |
+
st.write("No recorded interviews yet.")
|
| 171 |
+
|
| 172 |
def connect_resources():
|
| 173 |
st.subheader("Connect with Resources")
|
| 174 |
st.write("### Articles & Books")
|
|
|
|
| 332 |
<p>© 2024 TechPrep. All rights reserved.</p>
|
| 333 |
</div>
|
| 334 |
""", unsafe_allow_html=True)
|
| 335 |
+
|