Spaces:
Sleeping
Sleeping
IliaLarchenko
commited on
Commit
·
f8f508f
1
Parent(s):
63d96fd
Added interview duration to feedback
Browse files- ui/coding.py +19 -3
ui/coding.py
CHANGED
@@ -160,6 +160,7 @@ def get_problem_solving_ui(
|
|
160 |
gr.Markdown(DEMO_MESSAGE)
|
161 |
chat_history = gr.State([])
|
162 |
previous_code = gr.State("")
|
|
|
163 |
hi_markdown = gr.Markdown(
|
164 |
"<h2 style='text-align: center;'> Hi! I'm here to guide you through a practice session for your technical interview. Choose the interview settings to begin.</h2>\n"
|
165 |
)
|
@@ -242,12 +243,25 @@ def get_problem_solving_ui(
|
|
242 |
audio_to_transcribe = gr.State(np.array([], dtype=np.int16))
|
243 |
|
244 |
with gr.Accordion("Feedback", open=True, visible=False) as feedback_acc:
|
|
|
245 |
feedback = gr.Markdown(elem_id=f"feedback", line_breaks=True)
|
246 |
|
247 |
# Event handlers
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
fn=lambda: (
|
252 |
gr.update(visible=False),
|
253 |
gr.update(interactive=False),
|
@@ -288,6 +302,8 @@ def get_problem_solving_ui(
|
|
288 |
outputs=[feedback_acc],
|
289 |
).success(
|
290 |
fn=llm.end_interview, inputs=[description, chat_history, interview_type_select], outputs=[feedback]
|
|
|
|
|
291 |
)
|
292 |
|
293 |
hidden_text = gr.State("")
|
|
|
160 |
gr.Markdown(DEMO_MESSAGE)
|
161 |
chat_history = gr.State([])
|
162 |
previous_code = gr.State("")
|
163 |
+
start_time = gr.State(None)
|
164 |
hi_markdown = gr.Markdown(
|
165 |
"<h2 style='text-align: center;'> Hi! I'm here to guide you through a practice session for your technical interview. Choose the interview settings to begin.</h2>\n"
|
166 |
)
|
|
|
243 |
audio_to_transcribe = gr.State(np.array([], dtype=np.int16))
|
244 |
|
245 |
with gr.Accordion("Feedback", open=True, visible=False) as feedback_acc:
|
246 |
+
interview_time = gr.Markdown()
|
247 |
feedback = gr.Markdown(elem_id=f"feedback", line_breaks=True)
|
248 |
|
249 |
# Event handlers
|
250 |
+
def start_timer():
|
251 |
+
return time.time()
|
252 |
+
|
253 |
+
def get_duration_string(start_time):
|
254 |
+
if start_time is None:
|
255 |
+
duration_str = ""
|
256 |
+
else:
|
257 |
+
duration = int(time.time() - start_time)
|
258 |
+
minutes, seconds = divmod(duration, 60)
|
259 |
+
duration_str = f"Interview duration: {minutes} minutes, {seconds} seconds"
|
260 |
+
return duration_str
|
261 |
+
|
262 |
+
start_btn.click(fn=start_timer, outputs=[start_time]).success(
|
263 |
+
fn=add_interviewer_message(fixed_messages["start"]), inputs=[chat], outputs=[chat]
|
264 |
+
).success(fn=tts.read_last_message, inputs=[chat], outputs=[audio_output]).success(
|
265 |
fn=lambda: (
|
266 |
gr.update(visible=False),
|
267 |
gr.update(interactive=False),
|
|
|
302 |
outputs=[feedback_acc],
|
303 |
).success(
|
304 |
fn=llm.end_interview, inputs=[description, chat_history, interview_type_select], outputs=[feedback]
|
305 |
+
).success(
|
306 |
+
fn=get_duration_string, inputs=[start_time], outputs=[interview_time]
|
307 |
)
|
308 |
|
309 |
hidden_text = gr.State("")
|