Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
import streamlit as st
|
| 3 |
import openai
|
| 4 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
|
@@ -227,11 +226,41 @@ st.markdown(
|
|
| 227 |
}
|
| 228 |
.sidebar {
|
| 229 |
background-color: #ffffff; /* Sidebar background color */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
}
|
| 231 |
</style>
|
| 232 |
-
""",
|
|
|
|
| 233 |
)
|
| 234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
# Initialize session state for questions and current index
|
| 236 |
if 'questions' not in st.session_state:
|
| 237 |
st.session_state.questions = []
|
|
@@ -272,6 +301,9 @@ if nav_option == "Generate Questions":
|
|
| 272 |
if index < len(question_list):
|
| 273 |
st.write(f"**Question {index + 1}:** {question_list[index]}")
|
| 274 |
|
|
|
|
|
|
|
|
|
|
| 275 |
col1, col2 = st.columns(2)
|
| 276 |
with col1:
|
| 277 |
if index > 0:
|
|
@@ -285,6 +317,17 @@ if nav_option == "Generate Questions":
|
|
| 285 |
st.session_state.question_index += 1
|
| 286 |
st.experimental_rerun() # Re-run to update display
|
| 287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
elif nav_option == "Mock Interview":
|
| 289 |
st.header("🎥 Mock Interview")
|
| 290 |
schedule_mock_interview()
|
|
@@ -295,5 +338,12 @@ elif nav_option == "Track Progress":
|
|
| 295 |
elif nav_option == "Connect with Resources":
|
| 296 |
connect_resources()
|
| 297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
|
| 299 |
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import openai
|
| 3 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
|
|
|
| 226 |
}
|
| 227 |
.sidebar {
|
| 228 |
background-color: #ffffff; /* Sidebar background color */
|
| 229 |
+
padding: 1em;
|
| 230 |
+
}
|
| 231 |
+
.footer {
|
| 232 |
+
background-color: #4CAF50;
|
| 233 |
+
color: white;
|
| 234 |
+
text-align: center;
|
| 235 |
+
padding: 1em;
|
| 236 |
+
position: fixed;
|
| 237 |
+
bottom: 0;
|
| 238 |
+
width: 100%;
|
| 239 |
+
border-top: 2px solid #ffffff;
|
| 240 |
}
|
| 241 |
</style>
|
| 242 |
+
""",
|
| 243 |
+
unsafe_allow_html=True
|
| 244 |
)
|
| 245 |
|
| 246 |
+
# Show welcome message with an icon for 3-4 seconds
|
| 247 |
+
welcome_message = st.empty()
|
| 248 |
+
with welcome_message.container():
|
| 249 |
+
st.markdown("""
|
| 250 |
+
<div style="
|
| 251 |
+
text-align: center;
|
| 252 |
+
padding: 20px;
|
| 253 |
+
background-color: #4CAF50;
|
| 254 |
+
color: white;
|
| 255 |
+
border-radius: 8px;
|
| 256 |
+
font-size: 24px;
|
| 257 |
+
">
|
| 258 |
+
<i class="fa fa-smile-o" aria-hidden="true" style="font-size: 40px;"></i> Welcome to TechPrep!
|
| 259 |
+
</div>
|
| 260 |
+
""", unsafe_allow_html=True)
|
| 261 |
+
time.sleep(4) # Wait for 4 seconds
|
| 262 |
+
welcome_message.empty() # Remove the welcome message
|
| 263 |
+
|
| 264 |
# Initialize session state for questions and current index
|
| 265 |
if 'questions' not in st.session_state:
|
| 266 |
st.session_state.questions = []
|
|
|
|
| 301 |
if index < len(question_list):
|
| 302 |
st.write(f"**Question {index + 1}:** {question_list[index]}")
|
| 303 |
|
| 304 |
+
# Answer input box
|
| 305 |
+
answer = st.text_area("Your Answer", key="text_area_answer")
|
| 306 |
+
|
| 307 |
col1, col2 = st.columns(2)
|
| 308 |
with col1:
|
| 309 |
if index > 0:
|
|
|
|
| 317 |
st.session_state.question_index += 1
|
| 318 |
st.experimental_rerun() # Re-run to update display
|
| 319 |
|
| 320 |
+
# Submit answer and provide feedback
|
| 321 |
+
if st.button("Submit Answer"):
|
| 322 |
+
if not answer:
|
| 323 |
+
st.error("Please enter an answer to receive feedback.")
|
| 324 |
+
else:
|
| 325 |
+
with st.spinner("Providing feedback..."):
|
| 326 |
+
feedback = provide_feedback(model_choice, answer)
|
| 327 |
+
st.markdown(style_output("Feedback Received:", "#FF5722"), unsafe_allow_html=True)
|
| 328 |
+
st.write(feedback)
|
| 329 |
+
progress_data["feedback_provided"] += 1
|
| 330 |
+
|
| 331 |
elif nav_option == "Mock Interview":
|
| 332 |
st.header("🎥 Mock Interview")
|
| 333 |
schedule_mock_interview()
|
|
|
|
| 338 |
elif nav_option == "Connect with Resources":
|
| 339 |
connect_resources()
|
| 340 |
|
| 341 |
+
# Footer
|
| 342 |
+
st.markdown("""
|
| 343 |
+
<div class="footer">
|
| 344 |
+
<p>© 2024 TechPrep. All rights reserved.</p>
|
| 345 |
+
</div>
|
| 346 |
+
""", unsafe_allow_html=True)
|
| 347 |
+
|
| 348 |
|
| 349 |
|