Update app.py
Browse files
app.py
CHANGED
|
@@ -200,98 +200,72 @@ with gr.Blocks(title="PrepGenie - Mock Interviewer") as demo:
|
|
| 200 |
elem_id="title"
|
| 201 |
)
|
| 202 |
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
with gr.Row():
|
| 234 |
with gr.Column():
|
| 235 |
-
|
| 236 |
-
|
| 237 |
with gr.Column():
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
evaluation_chart_display = gr.Image(label="Skills Breakdown", type="pil", visible=False)
|
| 259 |
-
|
| 260 |
-
# --- Chat Section ---
|
| 261 |
-
if CHAT_MODULE_AVAILABLE:
|
| 262 |
-
with gr.Column(visible=False) as chat_selection:
|
| 263 |
-
gr.Markdown("## Chat with Resume")
|
| 264 |
-
with gr.Row():
|
| 265 |
-
with gr.Column():
|
| 266 |
-
file_upload_chat = gr.File(label="Upload Resume (PDF)", file_types=[".pdf"])
|
| 267 |
-
process_chat_btn = gr.Button("Process Resume")
|
| 268 |
-
with gr.Column():
|
| 269 |
-
file_status_chat = gr.Textbox(label="Status", interactive=False)
|
| 270 |
-
chatbot = gr.Chatbot(label="Chat History", visible=False, type="messages")
|
| 271 |
-
query_input = gr.Textbox(label="Ask about your resume", placeholder="Type your question here...", visible=False)
|
| 272 |
-
send_btn = gr.Button("Send", visible=False)
|
| 273 |
-
else:
|
| 274 |
-
with gr.Column(visible=False) as chat_selection:
|
| 275 |
-
gr.Markdown("## Chat with Resume (Unavailable)")
|
| 276 |
-
gr.Textbox(value="Chat module is not available.", interactive=False)
|
| 277 |
-
|
| 278 |
-
# --- History Section ---
|
| 279 |
-
with gr.Column(visible=False) as history_selection:
|
| 280 |
-
gr.Markdown("## Your Interview History")
|
| 281 |
-
# Use the new history_state to load past interviews
|
| 282 |
-
load_history_btn = gr.Button("Load My Past Interviews")
|
| 283 |
-
history_output = gr.Textbox(label="Past Interviews", max_lines=30, interactive=False, visible=True)
|
| 284 |
-
|
| 285 |
-
# Assign view variables for navigation
|
| 286 |
-
interview_view = interview_selection
|
| 287 |
-
chat_view = chat_selection
|
| 288 |
-
history_view = history_selection
|
| 289 |
-
|
| 290 |
-
# Navigation button listeners
|
| 291 |
-
mock_interview_btn.click(fn=navigate_to_interview, inputs=None, outputs=[interview_view, chat_view, history_view])
|
| 292 |
-
if CHAT_MODULE_AVAILABLE:
|
| 293 |
-
chat_btn.click(fn=navigate_to_chat, inputs=None, outputs=[interview_view, chat_view, history_view])
|
| 294 |
-
history_btn.click(fn=navigate_to_history, inputs=None, outputs=[interview_view, chat_view, history_view])
|
| 295 |
|
| 296 |
# --- Event Listeners for Interview ---
|
| 297 |
process_btn_interview.click(
|
|
|
|
| 200 |
elem_id="title"
|
| 201 |
)
|
| 202 |
|
| 203 |
+
# --- Main App Sections ---
|
| 204 |
+
with gr.Column(visible=False) as main_app:
|
| 205 |
+
with gr.Row():
|
| 206 |
+
with gr.Column(scale=1):
|
| 207 |
+
logout_btn = gr.Button("Logout")
|
| 208 |
+
# This column needs content indented inside it
|
| 209 |
+
with gr.Column(scale=4):
|
| 210 |
+
# --- Interview Section ---
|
| 211 |
+
with gr.Column(visible=False) as interview_selection:
|
| 212 |
+
gr.Markdown("## Mock Interview")
|
| 213 |
+
with gr.Row():
|
| 214 |
+
with gr.Column():
|
| 215 |
+
file_upload_interview = gr.File(label="Upload Resume (PDF)", file_types=[".pdf"])
|
| 216 |
+
process_btn_interview = gr.Button("Process Resume")
|
| 217 |
+
with gr.Column():
|
| 218 |
+
file_status_interview = gr.Textbox(label="Status", interactive=False)
|
| 219 |
+
role_selection = gr.Dropdown(
|
| 220 |
+
choices=["Data Scientist", "Software Engineer", "Product Manager", "Data Analyst", "Business Analyst"],
|
| 221 |
+
multiselect=True, label="Select Job Role(s)", visible=False
|
| 222 |
+
)
|
| 223 |
+
start_interview_btn = gr.Button("Start Interview", visible=False)
|
| 224 |
+
question_display = gr.Textbox(label="Question", interactive=False, visible=False)
|
| 225 |
+
answer_instructions = gr.Markdown("Click 'Record Answer' and speak your response.", visible=False)
|
| 226 |
+
audio_input = gr.Audio(label="Record Answer", type="numpy", visible=False)
|
| 227 |
+
submit_answer_btn = gr.Button("Submit Answer", visible=False)
|
| 228 |
+
next_question_btn = gr.Button("Next Question", visible=False)
|
| 229 |
+
submit_interview_btn = gr.Button("Submit Interview", visible=False, variant="primary")
|
| 230 |
+
answer_display = gr.Textbox(label="Your Answer", interactive=False, visible=False)
|
| 231 |
+
feedback_display = gr.Textbox(label="Feedback", interactive=False, visible=False)
|
| 232 |
+
metrics_display = gr.JSON(label="Metrics", visible=False)
|
| 233 |
+
processed_resume_data_hidden_interview = gr.Textbox(visible=False)
|
| 234 |
+
# --- Evaluation Results Section ---
|
| 235 |
+
with gr.Column(visible=False) as evaluation_selection:
|
| 236 |
+
gr.Markdown("## Interview Evaluation Results")
|
| 237 |
+
evaluation_report_display = gr.Markdown(label="Your Evaluation Report", visible=False)
|
| 238 |
+
evaluation_chart_display = gr.Image(label="Skills Breakdown", type="pil", visible=False)
|
| 239 |
+
|
| 240 |
+
# --- Chat Section ---
|
| 241 |
+
if CHAT_MODULE_AVAILABLE:
|
| 242 |
+
with gr.Column(visible=False) as chat_selection:
|
| 243 |
+
gr.Markdown("## Chat with Resume")
|
| 244 |
with gr.Row():
|
| 245 |
with gr.Column():
|
| 246 |
+
file_upload_chat = gr.File(label="Upload Resume (PDF)", file_types=[".pdf"])
|
| 247 |
+
process_chat_btn = gr.Button("Process Resume")
|
| 248 |
with gr.Column():
|
| 249 |
+
file_status_chat = gr.Textbox(label="Status", interactive=False)
|
| 250 |
+
chatbot = gr.Chatbot(label="Chat History", visible=False, type="messages")
|
| 251 |
+
query_input = gr.Textbox(label="Ask about your resume", placeholder="Type your question here...", visible=False)
|
| 252 |
+
send_btn = gr.Button("Send", visible=False)
|
| 253 |
+
else:
|
| 254 |
+
with gr.Column(visible=False) as chat_selection:
|
| 255 |
+
gr.Markdown("## Chat with Resume (Unavailable)")
|
| 256 |
+
gr.Textbox(value="Chat module is not available.", interactive=False)
|
| 257 |
+
|
| 258 |
+
# --- History Section ---
|
| 259 |
+
with gr.Column(visible=False) as history_selection:
|
| 260 |
+
gr.Markdown("## Your Interview History")
|
| 261 |
+
load_history_btn = gr.Button("Load My Past Interviews")
|
| 262 |
+
history_output = gr.Textbox(label="Past Interviews", max_lines=30, interactive=False, visible=True)
|
| 263 |
+
|
| 264 |
+
# Navigation button listeners (these should be inside the main_app column)
|
| 265 |
+
interview_btn.click(fn=navigate_to_interview, inputs=None, outputs=[interview_view, chat_view, history_view])
|
| 266 |
+
if CHAT_MODULE_AVAILABLE:
|
| 267 |
+
chat_btn.click(fn=navigate_to_chat, inputs=None, outputs=[interview_view, chat_view, history_view])
|
| 268 |
+
history_btn.click(fn=navigate_to_history, inputs=None, outputs=[interview_view, chat_view, history_view])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
|
| 270 |
# --- Event Listeners for Interview ---
|
| 271 |
process_btn_interview.click(
|