IliaLarchenko commited on
Commit
953f193
1 Parent(s): 3aff026

Added elements_id

Browse files
Files changed (1) hide show
  1. ui/coding.py +17 -9
ui/coding.py CHANGED
@@ -6,7 +6,7 @@ from utils.ui import add_candidate_message, add_interviewer_message
6
 
7
 
8
  def get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, name="Coding", interview_type="coding"):
9
- with gr.Tab(name, render=False) as problem_tab:
10
  chat_history = gr.State([])
11
  previous_code = gr.State("")
12
  started_coding = gr.State(False)
@@ -23,6 +23,7 @@ def get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, na
23
  value="Medium",
24
  container=False,
25
  allow_custom_value=True,
 
26
  )
27
  with gr.Row():
28
  topics = topic_lists[interview_type.value].copy()
@@ -34,13 +35,16 @@ def get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, na
34
  value=topics[0],
35
  container=False,
36
  allow_custom_value=True,
 
37
  )
38
  with gr.Column(scale=2):
39
- requirements = gr.Textbox(label="Requirements", placeholder="Specify additional requirements", lines=5)
40
- start_btn = gr.Button("Generate a problem")
 
 
41
 
42
  with gr.Accordion("Problem statement", open=True) as problem_acc:
43
- description = gr.Markdown()
44
  with gr.Accordion("Solution", open=False) as solution_acc:
45
  with gr.Row() as content:
46
  with gr.Column(scale=2):
@@ -49,22 +53,25 @@ def get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, na
49
  label="Please write your code here. You can use any language, but only Python syntax highlighting is available.",
50
  language="python",
51
  lines=46,
 
52
  )
53
  elif interview_type.value == "sql":
54
  code = gr.Code(
55
  label="Please write your query here.",
56
  language="sql",
57
  lines=46,
 
58
  )
59
  else:
60
  code = gr.Code(
61
  label="Please write any notes for your solution here.",
62
  language=None,
63
  lines=46,
 
64
  )
65
  with gr.Column(scale=1):
66
- end_btn = gr.Button("Finish the interview", interactive=False)
67
- chat = gr.Chatbot(label="Chat", show_label=False, show_share_button=False)
68
  message = gr.Textbox(
69
  label="Message",
70
  show_label=False,
@@ -72,15 +79,16 @@ def get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, na
72
  max_lines=3,
73
  interactive=True,
74
  container=False,
 
75
  )
76
- send_btn = gr.Button("Send", interactive=False)
77
- audio_input = gr.Audio(interactive=False, **default_audio_params)
78
 
79
  audio_buffer = gr.State(np.array([], dtype=np.int16))
80
  transcript = gr.State({"words": [], "not_confirmed": 0, "last_cutoff": 0, "text": ""})
81
 
82
  with gr.Accordion("Feedback", open=True) as feedback_acc:
83
- feedback = gr.Markdown()
84
 
85
  start_btn.click(fn=add_interviewer_message(fixed_messages["start"]), inputs=[chat], outputs=[chat]).success(
86
  fn=lambda: True, outputs=[started_coding]
 
6
 
7
 
8
  def get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, name="Coding", interview_type="coding"):
9
+ with gr.Tab(name, render=False, elem_id=f"name_tab") as problem_tab:
10
  chat_history = gr.State([])
11
  previous_code = gr.State("")
12
  started_coding = gr.State(False)
 
23
  value="Medium",
24
  container=False,
25
  allow_custom_value=True,
26
+ elem_id="difficulty_select",
27
  )
28
  with gr.Row():
29
  topics = topic_lists[interview_type.value].copy()
 
35
  value=topics[0],
36
  container=False,
37
  allow_custom_value=True,
38
+ elem_id="topic_select",
39
  )
40
  with gr.Column(scale=2):
41
+ requirements = gr.Textbox(
42
+ label="Requirements", placeholder="Specify additional requirements", lines=5, elem_id="requirements"
43
+ )
44
+ start_btn = gr.Button("Generate a problem", elem_id="start_btn")
45
 
46
  with gr.Accordion("Problem statement", open=True) as problem_acc:
47
+ description = gr.Markdown(elem_id="problem_description")
48
  with gr.Accordion("Solution", open=False) as solution_acc:
49
  with gr.Row() as content:
50
  with gr.Column(scale=2):
 
53
  label="Please write your code here. You can use any language, but only Python syntax highlighting is available.",
54
  language="python",
55
  lines=46,
56
+ elem_id="code",
57
  )
58
  elif interview_type.value == "sql":
59
  code = gr.Code(
60
  label="Please write your query here.",
61
  language="sql",
62
  lines=46,
63
+ elem_id="code",
64
  )
65
  else:
66
  code = gr.Code(
67
  label="Please write any notes for your solution here.",
68
  language=None,
69
  lines=46,
70
+ elem_id="code",
71
  )
72
  with gr.Column(scale=1):
73
+ end_btn = gr.Button("Finish the interview", interactive=False, variant="stop", elem_id="end_btn")
74
+ chat = gr.Chatbot(label="Chat", show_label=False, show_share_button=False, elem_id="chat")
75
  message = gr.Textbox(
76
  label="Message",
77
  show_label=False,
 
79
  max_lines=3,
80
  interactive=True,
81
  container=False,
82
+ elem_id="message",
83
  )
84
+ send_btn = gr.Button("Send", interactive=False, elem_id="send_btn")
85
+ audio_input = gr.Audio(interactive=False, **default_audio_params, elem_id="audio_input")
86
 
87
  audio_buffer = gr.State(np.array([], dtype=np.int16))
88
  transcript = gr.State({"words": [], "not_confirmed": 0, "last_cutoff": 0, "text": ""})
89
 
90
  with gr.Accordion("Feedback", open=True) as feedback_acc:
91
+ feedback = gr.Markdown(elem_id="feedback")
92
 
93
  start_btn.click(fn=add_interviewer_message(fixed_messages["start"]), inputs=[chat], outputs=[chat]).success(
94
  fn=lambda: True, outputs=[started_coding]