Update app.py
Browse files
app.py
CHANGED
|
@@ -93,7 +93,7 @@ def submit_answer_handler(audio, interview_state):
|
|
| 93 |
result = interview_logic.submit_answer_logic(audio, interview_state, TEXT_MODEL)
|
| 94 |
ui_updates = apply_ui_updates(result["ui_updates"])
|
| 95 |
|
| 96 |
-
# Guard: ensure metrics is always a valid dict
|
| 97 |
metrics_value = result.get("metrics") or {
|
| 98 |
"Communication skills": 0.0,
|
| 99 |
"Teamwork and collaboration": 0.0,
|
|
@@ -102,7 +102,7 @@ def submit_answer_handler(audio, interview_state):
|
|
| 102 |
"Adaptability and resilience": 0.0
|
| 103 |
}
|
| 104 |
|
| 105 |
-
# Define feedback_update properly
|
| 106 |
feedback_update = ui_updates.get("feedback_display", gr.update())
|
| 107 |
if "gr_show_and_update" in result["ui_updates"].values():
|
| 108 |
feedback_update = gr.update(visible=True, value=result["feedback_text"])
|
|
@@ -116,7 +116,7 @@ def submit_answer_handler(audio, interview_state):
|
|
| 116 |
result["status"],
|
| 117 |
result["answer_text"],
|
| 118 |
result["interview_state"],
|
| 119 |
-
feedback_update,
|
| 120 |
metrics_update,
|
| 121 |
ui_updates.get("audio_input", gr.update()),
|
| 122 |
ui_updates.get("submit_answer_btn", gr.update()),
|
|
|
|
| 93 |
result = interview_logic.submit_answer_logic(audio, interview_state, TEXT_MODEL)
|
| 94 |
ui_updates = apply_ui_updates(result["ui_updates"])
|
| 95 |
|
| 96 |
+
# Guard: ensure metrics is always a valid dict, never None or ""
|
| 97 |
metrics_value = result.get("metrics") or {
|
| 98 |
"Communication skills": 0.0,
|
| 99 |
"Teamwork and collaboration": 0.0,
|
|
|
|
| 102 |
"Adaptability and resilience": 0.0
|
| 103 |
}
|
| 104 |
|
| 105 |
+
# FIX: Define feedback_update properly before using it
|
| 106 |
feedback_update = ui_updates.get("feedback_display", gr.update())
|
| 107 |
if "gr_show_and_update" in result["ui_updates"].values():
|
| 108 |
feedback_update = gr.update(visible=True, value=result["feedback_text"])
|
|
|
|
| 116 |
result["status"],
|
| 117 |
result["answer_text"],
|
| 118 |
result["interview_state"],
|
| 119 |
+
feedback_update, # Now defined
|
| 120 |
metrics_update,
|
| 121 |
ui_updates.get("audio_input", gr.update()),
|
| 122 |
ui_updates.get("submit_answer_btn", gr.update()),
|