DmitryRyumin commited on
Commit
8f52d54
β€’
1 Parent(s): 2f050c0
app.css CHANGED
@@ -179,6 +179,10 @@ div.languages-container > div.country_flags div.image-container > button > div.i
179
  height: 32px;
180
  }
181
 
 
 
 
 
182
  .dropdown-language-container {
183
  display: contents;
184
  }
 
179
  height: 32px;
180
  }
181
 
182
+ div.languages-container > div.country_flags div.image-container > div.icon-button-wrapper {
183
+ display: none;
184
+ }
185
+
186
  .dropdown-language-container {
187
  display: contents;
188
  }
app/event_handlers/calculate_practical_tasks.py CHANGED
@@ -18,6 +18,7 @@ from app.utils import (
18
  read_csv_file,
19
  apply_rounding_and_rename_columns,
20
  preprocess_scores_df,
 
21
  )
22
  from app.components import (
23
  html_message,
@@ -166,6 +167,7 @@ def create_person_metadata(person_id, files, video_metadata):
166
 
167
 
168
  def event_handler_calculate_practical_task_blocks(
 
169
  type_modes,
170
  files,
171
  video,
@@ -190,6 +192,8 @@ def event_handler_calculate_practical_task_blocks(
190
  number_agreeableness,
191
  number_non_neuroticism,
192
  ):
 
 
193
  if type_modes == config_data.Settings_TYPE_MODES[1]:
194
  files = [video]
195
 
 
18
  read_csv_file,
19
  apply_rounding_and_rename_columns,
20
  preprocess_scores_df,
21
+ get_language_settings,
22
  )
23
  from app.components import (
24
  html_message,
 
167
 
168
 
169
  def event_handler_calculate_practical_task_blocks(
170
+ language,
171
  type_modes,
172
  files,
173
  video,
 
192
  number_agreeableness,
193
  number_non_neuroticism,
194
  ):
195
+ lang_id, _ = get_language_settings(language)
196
+
197
  if type_modes == config_data.Settings_TYPE_MODES[1]:
198
  files = [video]
199
 
app/event_handlers/calculate_pt_scores_blocks.py CHANGED
@@ -6,7 +6,6 @@ License: MIT License
6
  """
7
 
8
  import gradio as gr
9
- import pandas as pd
10
 
11
  # Importing necessary components for the Gradio app
12
  from app.oceanai_init import b5
@@ -165,6 +164,19 @@ def event_handler_calculate_pt_scores_blocks(
165
  df_files = b5.df_files_.copy()
166
  df_files.reset_index(inplace=True)
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  return (
169
  html_message(
170
  config_data.InformationMessages_NOTI_VIDEOS[lang_id], False, False
@@ -189,7 +201,7 @@ def event_handler_calculate_pt_scores_blocks(
189
  radio_create_ui(
190
  first_practical_task,
191
  config_data.Labels_PRACTICAL_TASKS_LABEL[lang_id],
192
- list(map(str, supported_practical_tasks[lang_id].keys())),
193
  config_data.InformationMessages_PRACTICAL_TASKS_INFO[lang_id],
194
  True,
195
  True,
@@ -211,13 +223,15 @@ def event_handler_calculate_pt_scores_blocks(
211
  visible=False,
212
  render=True,
213
  ),
214
- gr.Column(visible=True),
 
 
215
  dropdown_create_ui(
216
  label=f"Potential candidates by Personality Type of MBTI ({len(config_data.Settings_DROPDOWN_MBTI)})",
217
  info=config_data.InformationMessages_DROPDOWN_MBTI_INFO,
218
  choices=config_data.Settings_DROPDOWN_MBTI,
219
  value=config_data.Settings_DROPDOWN_MBTI[0],
220
- visible=True,
221
  elem_classes="dropdown-container",
222
  ),
223
  number_create_ui(
@@ -229,7 +243,7 @@ def event_handler_calculate_pt_scores_blocks(
229
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
230
  show_label=True,
231
  interactive=True,
232
- visible=True,
233
  render=True,
234
  elem_classes="number-container",
235
  ),
 
6
  """
7
 
8
  import gradio as gr
 
9
 
10
  # Importing necessary components for the Gradio app
11
  from app.oceanai_init import b5
 
164
  df_files = b5.df_files_.copy()
165
  df_files.reset_index(inplace=True)
166
 
167
+ if type_modes == config_data.Settings_TYPE_MODES[0]:
168
+ practical_tasks_choices = list(
169
+ map(str, supported_practical_tasks[lang_id].keys())
170
+ )
171
+ elif type_modes == config_data.Settings_TYPE_MODES[1]:
172
+ practical_tasks_choices = [
173
+ value
174
+ for i, value in enumerate(
175
+ map(str, supported_practical_tasks[lang_id].keys())
176
+ )
177
+ if i not in {1}
178
+ ]
179
+
180
  return (
181
  html_message(
182
  config_data.InformationMessages_NOTI_VIDEOS[lang_id], False, False
 
201
  radio_create_ui(
202
  first_practical_task,
203
  config_data.Labels_PRACTICAL_TASKS_LABEL[lang_id],
204
+ practical_tasks_choices,
205
  config_data.InformationMessages_PRACTICAL_TASKS_INFO[lang_id],
206
  True,
207
  True,
 
223
  visible=False,
224
  render=True,
225
  ),
226
+ gr.Column(
227
+ visible=True if type_modes == config_data.Settings_TYPE_MODES[0] else False
228
+ ),
229
  dropdown_create_ui(
230
  label=f"Potential candidates by Personality Type of MBTI ({len(config_data.Settings_DROPDOWN_MBTI)})",
231
  info=config_data.InformationMessages_DROPDOWN_MBTI_INFO,
232
  choices=config_data.Settings_DROPDOWN_MBTI,
233
  value=config_data.Settings_DROPDOWN_MBTI[0],
234
+ visible=True if type_modes == config_data.Settings_TYPE_MODES[0] else False,
235
  elem_classes="dropdown-container",
236
  ),
237
  number_create_ui(
 
243
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
244
  show_label=True,
245
  interactive=True,
246
+ visible=True if type_modes == config_data.Settings_TYPE_MODES[0] else False,
247
  render=True,
248
  elem_classes="number-container",
249
  ),
app/event_handlers/event_handlers.py CHANGED
@@ -436,7 +436,13 @@ def setup_app_event_handlers(
436
  )
437
  practical_subtasks.change(
438
  event_handler_practical_subtasks,
439
- [practical_tasks, practical_subtasks, practical_subtasks_selected],
 
 
 
 
 
 
440
  [
441
  practical_subtasks_selected,
442
  settings_practical_tasks,
@@ -477,6 +483,7 @@ def setup_app_event_handlers(
477
  calculate_practical_task.click(
478
  fn=event_handler_calculate_practical_task_blocks,
479
  inputs=[
 
480
  type_modes,
481
  files,
482
  video,
 
436
  )
437
  practical_subtasks.change(
438
  event_handler_practical_subtasks,
439
+ [
440
+ languages,
441
+ type_modes,
442
+ practical_tasks,
443
+ practical_subtasks,
444
+ practical_subtasks_selected,
445
+ ],
446
  [
447
  practical_subtasks_selected,
448
  settings_practical_tasks,
 
483
  calculate_practical_task.click(
484
  fn=event_handler_calculate_practical_task_blocks,
485
  inputs=[
486
+ languages,
487
  type_modes,
488
  files,
489
  video,
app/event_handlers/practical_subtasks.py CHANGED
@@ -9,25 +9,35 @@ import gradio as gr
9
 
10
  # Importing necessary components for the Gradio app
11
  from app.config import config_data
12
- from app.utils import read_csv_file, extract_profession_weights
13
  from app.components import number_create_ui, dropdown_create_ui
14
 
15
 
16
  def event_handler_practical_subtasks(
17
- practical_tasks, practical_subtasks, practical_subtasks_selected
 
 
 
 
18
  ):
 
 
19
  practical_subtasks_selected[practical_tasks] = practical_subtasks
20
 
 
 
 
 
21
  if practical_subtasks.lower() == "16 personality types of mbti":
22
  return (
23
  practical_subtasks_selected,
24
- gr.Column(visible=True),
25
  dropdown_create_ui(
26
  label=f"Potential candidates by Personality Type of MBTI ({len(config_data.Settings_DROPDOWN_MBTI)})",
27
  info=config_data.InformationMessages_DROPDOWN_MBTI_INFO,
28
  choices=config_data.Settings_DROPDOWN_MBTI,
29
  value=config_data.Settings_DROPDOWN_MBTI[0],
30
- visible=True,
31
  elem_classes="dropdown-container",
32
  ),
33
  number_create_ui(
@@ -39,7 +49,7 @@ def event_handler_practical_subtasks(
39
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
40
  show_label=True,
41
  interactive=True,
42
- visible=True,
43
  render=True,
44
  elem_classes="number-container",
45
  ),
@@ -72,7 +82,7 @@ def event_handler_practical_subtasks(
72
 
73
  return (
74
  practical_subtasks_selected,
75
- gr.Column(visible=True),
76
  dropdown_create_ui(visible=False),
77
  number_create_ui(visible=False),
78
  number_create_ui(visible=False),
@@ -91,7 +101,7 @@ def event_handler_practical_subtasks(
91
  info=config_data.InformationMessages_DROPDOWN_CANDIDATES_INFO,
92
  choices=config_data.Settings_DROPDOWN_CANDIDATES,
93
  value=config_data.Settings_DROPDOWN_CANDIDATES[0],
94
- visible=True,
95
  elem_classes="dropdown-container",
96
  ),
97
  number_create_ui(
@@ -105,7 +115,7 @@ def event_handler_practical_subtasks(
105
  ),
106
  show_label=True,
107
  interactive=interactive_professions,
108
- visible=True,
109
  render=True,
110
  elem_classes="number-container",
111
  ),
@@ -120,7 +130,7 @@ def event_handler_practical_subtasks(
120
  ),
121
  show_label=True,
122
  interactive=interactive_professions,
123
- visible=True,
124
  render=True,
125
  elem_classes="number-container",
126
  ),
@@ -135,7 +145,7 @@ def event_handler_practical_subtasks(
135
  ),
136
  show_label=True,
137
  interactive=interactive_professions,
138
- visible=True,
139
  render=True,
140
  elem_classes="number-container",
141
  ),
@@ -150,7 +160,7 @@ def event_handler_practical_subtasks(
150
  ),
151
  show_label=True,
152
  interactive=interactive_professions,
153
- visible=True,
154
  render=True,
155
  elem_classes="number-container",
156
  ),
@@ -165,7 +175,7 @@ def event_handler_practical_subtasks(
165
  ),
166
  show_label=True,
167
  interactive=interactive_professions,
168
- visible=True,
169
  render=True,
170
  elem_classes="number-container",
171
  ),
@@ -173,7 +183,7 @@ def event_handler_practical_subtasks(
173
  elif practical_subtasks.lower() == "professional skills":
174
  return (
175
  practical_subtasks_selected,
176
- gr.Column(visible=True),
177
  dropdown_create_ui(visible=False),
178
  number_create_ui(visible=False),
179
  number_create_ui(
@@ -185,7 +195,7 @@ def event_handler_practical_subtasks(
185
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
186
  show_label=True,
187
  interactive=True,
188
- visible=True,
189
  render=True,
190
  elem_classes="number-container",
191
  ),
@@ -194,7 +204,7 @@ def event_handler_practical_subtasks(
194
  info=config_data.InformationMessages_DROPDOWN_PROFESSIONAL_SKILLS_INFO,
195
  choices=config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS,
196
  value=config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS[0],
197
- visible=True,
198
  elem_classes="dropdown-container",
199
  ),
200
  number_create_ui(visible=False),
@@ -219,7 +229,7 @@ def event_handler_practical_subtasks(
219
  ):
220
  return (
221
  practical_subtasks_selected,
222
- gr.Column(visible=True),
223
  dropdown_create_ui(visible=False),
224
  number_create_ui(visible=False),
225
  number_create_ui(visible=False),
@@ -233,7 +243,7 @@ def event_handler_practical_subtasks(
233
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
234
  show_label=True,
235
  interactive=True,
236
- visible=True,
237
  render=True,
238
  elem_classes="number-container",
239
  ),
@@ -246,7 +256,7 @@ def event_handler_practical_subtasks(
246
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
247
  show_label=True,
248
  interactive=True,
249
- visible=True,
250
  render=True,
251
  elem_classes="number-container",
252
  ),
@@ -259,7 +269,7 @@ def event_handler_practical_subtasks(
259
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
260
  show_label=True,
261
  interactive=True,
262
- visible=True,
263
  render=True,
264
  elem_classes="number-container",
265
  ),
@@ -272,7 +282,7 @@ def event_handler_practical_subtasks(
272
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
273
  show_label=True,
274
  interactive=True,
275
- visible=True,
276
  render=True,
277
  elem_classes="number-container",
278
  ),
@@ -285,7 +295,7 @@ def event_handler_practical_subtasks(
285
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
286
  show_label=True,
287
  interactive=True,
288
- visible=True,
289
  render=True,
290
  elem_classes="number-container",
291
  ),
@@ -298,7 +308,7 @@ def event_handler_practical_subtasks(
298
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
299
  show_label=True,
300
  interactive=True,
301
- visible=True,
302
  render=True,
303
  elem_classes="number-container",
304
  ),
 
9
 
10
  # Importing necessary components for the Gradio app
11
  from app.config import config_data
12
+ from app.utils import read_csv_file, extract_profession_weights, get_language_settings
13
  from app.components import number_create_ui, dropdown_create_ui
14
 
15
 
16
  def event_handler_practical_subtasks(
17
+ language,
18
+ type_modes,
19
+ practical_tasks,
20
+ practical_subtasks,
21
+ practical_subtasks_selected,
22
  ):
23
+ lang_id, _ = get_language_settings(language)
24
+
25
  practical_subtasks_selected[practical_tasks] = practical_subtasks
26
 
27
+ visible_subtasks = (
28
+ True if type_modes == config_data.Settings_TYPE_MODES[0] else False
29
+ )
30
+
31
  if practical_subtasks.lower() == "16 personality types of mbti":
32
  return (
33
  practical_subtasks_selected,
34
+ gr.Column(visible=visible_subtasks),
35
  dropdown_create_ui(
36
  label=f"Potential candidates by Personality Type of MBTI ({len(config_data.Settings_DROPDOWN_MBTI)})",
37
  info=config_data.InformationMessages_DROPDOWN_MBTI_INFO,
38
  choices=config_data.Settings_DROPDOWN_MBTI,
39
  value=config_data.Settings_DROPDOWN_MBTI[0],
40
+ visible=visible_subtasks,
41
  elem_classes="dropdown-container",
42
  ),
43
  number_create_ui(
 
49
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
50
  show_label=True,
51
  interactive=True,
52
+ visible=visible_subtasks,
53
  render=True,
54
  elem_classes="number-container",
55
  ),
 
82
 
83
  return (
84
  practical_subtasks_selected,
85
+ gr.Column(visible=visible_subtasks),
86
  dropdown_create_ui(visible=False),
87
  number_create_ui(visible=False),
88
  number_create_ui(visible=False),
 
101
  info=config_data.InformationMessages_DROPDOWN_CANDIDATES_INFO,
102
  choices=config_data.Settings_DROPDOWN_CANDIDATES,
103
  value=config_data.Settings_DROPDOWN_CANDIDATES[0],
104
+ visible=visible_subtasks,
105
  elem_classes="dropdown-container",
106
  ),
107
  number_create_ui(
 
115
  ),
116
  show_label=True,
117
  interactive=interactive_professions,
118
+ visible=visible_subtasks,
119
  render=True,
120
  elem_classes="number-container",
121
  ),
 
130
  ),
131
  show_label=True,
132
  interactive=interactive_professions,
133
+ visible=visible_subtasks,
134
  render=True,
135
  elem_classes="number-container",
136
  ),
 
145
  ),
146
  show_label=True,
147
  interactive=interactive_professions,
148
+ visible=visible_subtasks,
149
  render=True,
150
  elem_classes="number-container",
151
  ),
 
160
  ),
161
  show_label=True,
162
  interactive=interactive_professions,
163
+ visible=visible_subtasks,
164
  render=True,
165
  elem_classes="number-container",
166
  ),
 
175
  ),
176
  show_label=True,
177
  interactive=interactive_professions,
178
+ visible=visible_subtasks,
179
  render=True,
180
  elem_classes="number-container",
181
  ),
 
183
  elif practical_subtasks.lower() == "professional skills":
184
  return (
185
  practical_subtasks_selected,
186
+ gr.Column(visible=visible_subtasks),
187
  dropdown_create_ui(visible=False),
188
  number_create_ui(visible=False),
189
  number_create_ui(
 
195
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
196
  show_label=True,
197
  interactive=True,
198
+ visible=visible_subtasks,
199
  render=True,
200
  elem_classes="number-container",
201
  ),
 
204
  info=config_data.InformationMessages_DROPDOWN_PROFESSIONAL_SKILLS_INFO,
205
  choices=config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS,
206
  value=config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS[0],
207
+ visible=visible_subtasks,
208
  elem_classes="dropdown-container",
209
  ),
210
  number_create_ui(visible=False),
 
229
  ):
230
  return (
231
  practical_subtasks_selected,
232
+ gr.Column(visible=visible_subtasks),
233
  dropdown_create_ui(visible=False),
234
  number_create_ui(visible=False),
235
  number_create_ui(visible=False),
 
243
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
244
  show_label=True,
245
  interactive=True,
246
+ visible=visible_subtasks,
247
  render=True,
248
  elem_classes="number-container",
249
  ),
 
256
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
257
  show_label=True,
258
  interactive=True,
259
+ visible=visible_subtasks,
260
  render=True,
261
  elem_classes="number-container",
262
  ),
 
269
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
270
  show_label=True,
271
  interactive=True,
272
+ visible=visible_subtasks,
273
  render=True,
274
  elem_classes="number-container",
275
  ),
 
282
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
283
  show_label=True,
284
  interactive=True,
285
+ visible=visible_subtasks,
286
  render=True,
287
  elem_classes="number-container",
288
  ),
 
295
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
296
  show_label=True,
297
  interactive=True,
298
+ visible=visible_subtasks,
299
  render=True,
300
  elem_classes="number-container",
301
  ),
 
308
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
309
  show_label=True,
310
  interactive=True,
311
+ visible=visible_subtasks,
312
  render=True,
313
  elem_classes="number-container",
314
  ),
config.toml CHANGED
@@ -1,5 +1,5 @@
1
  [AppSettings]
2
- APP_VERSION = "0.10.0"
3
  SERVER_NAME = "127.0.0.1"
4
  PORT = 7860
5
  CSS_PATH = "app.css"
 
1
  [AppSettings]
2
+ APP_VERSION = "0.10.1"
3
  SERVER_NAME = "127.0.0.1"
4
  PORT = 7860
5
  CSS_PATH = "app.css"