DmitryRyumin commited on
Commit
fe19555
1 Parent(s): a38174b
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 😀🤓😎😉😤
4
  colorFrom: gray
5
  colorTo: red
6
  sdk: gradio
7
- sdk_version: 5.7.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: gray
5
  colorTo: red
6
  sdk: gradio
7
+ sdk_version: 5.8.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.css CHANGED
@@ -265,6 +265,14 @@ div.surname-container > div.metadata_surname-logo div.image-container,
265
  div.email-container > div.metadata_email-logo div.image-container,
266
  div.phone-container > div.metadata_phone-logo div.image-container {
267
  width: fit-content;
 
 
 
 
 
 
 
 
268
  }
269
 
270
  div.name-container > div.metadata_name-logo div.image-container > button > div > img,
 
265
  div.email-container > div.metadata_email-logo div.image-container,
266
  div.phone-container > div.metadata_phone-logo div.image-container {
267
  width: fit-content;
268
+ min-width: auto;
269
+ }
270
+
271
+ div.name-container > div.metadata_name-logo div.image-container > div.icon-button-wrapper,
272
+ div.surname-container > div.metadata_surname-logo div.image-container > div.icon-button-wrapper,
273
+ div.email-container > div.metadata_email-logo div.image-container > div.icon-button-wrapper,
274
+ div.phone-container > div.metadata_phone-logo div.image-container > div.icon-button-wrapper {
275
+ display: none;
276
  }
277
 
278
  div.name-container > div.metadata_name-logo div.image-container > button > div > img,
app.py CHANGED
@@ -92,7 +92,7 @@ if __name__ == "__main__":
92
  free_ports(port)
93
 
94
  create_gradio_app().queue(api_open=False).launch(
95
- share=False,
96
  server_name=config_data.AppSettings_SERVER_NAME,
97
  server_port=config_data.AppSettings_PORT,
98
  )
 
92
  free_ports(port)
93
 
94
  create_gradio_app().queue(api_open=False).launch(
95
+ share=True,
96
  server_name=config_data.AppSettings_SERVER_NAME,
97
  server_port=config_data.AppSettings_PORT,
98
  )
app/event_handlers/calculate_pt_scores_blocks.py CHANGED
@@ -52,7 +52,7 @@ def event_handler_calculate_pt_scores_blocks(
52
  supported_practical_tasks_ren = supported_practical_tasks
53
  elif type_modes == config_data.Settings_TYPE_MODES[1]:
54
  rename_map = {
55
- "Ranking potential candidates by professional responsibilities": "Determine professional possibilities",
56
  "Ранжирование потенциальных кандидатов по профессиональным обязанностям": "Определить профессиональные возможности",
57
  }
58
 
 
52
  supported_practical_tasks_ren = supported_practical_tasks
53
  elif type_modes == config_data.Settings_TYPE_MODES[1]:
54
  rename_map = {
55
+ "Ranking potential candidates by professional responsibilities": "Estimating professional abilities",
56
  "Ранжирование потенциальных кандидатов по профессиональным обязанностям": "Определить профессиональные возможности",
57
  }
58
 
app/event_handlers/clear_blocks.py CHANGED
@@ -55,7 +55,11 @@ def event_handler_clear_blocks(language, type_modes):
55
 
56
  return (
57
  html_message(
58
- config_data.InformationMessages_NOTI_VIDEOS[lang_id],
 
 
 
 
59
  False,
60
  True,
61
  "notifications",
 
55
 
56
  return (
57
  html_message(
58
+ (
59
+ config_data.InformationMessages_NOTI_VIDEOS[lang_id].split("(")[0]
60
+ if lang_id == 0
61
+ else config_data.InformationMessages_NOTI_VIDEOS[lang_id]
62
+ ),
63
  False,
64
  True,
65
  "notifications",
app/event_handlers/event_handlers.py CHANGED
@@ -152,6 +152,7 @@ def setup_app_event_handlers(
152
  switching_modes,
153
  type_modes,
154
  video,
 
155
  calculate_pt_scores,
156
  clear_app,
157
  pt_scores,
@@ -298,13 +299,10 @@ def setup_app_event_handlers(
298
  )
299
  examples.click(
300
  fn=event_handler_examples_blocks,
301
- inputs=[languages],
302
  outputs=[
303
  notifications,
304
  files,
305
- webcam,
306
- switching_modes,
307
- type_modes,
308
  video,
309
  calculate_pt_scores,
310
  clear_app,
 
152
  switching_modes,
153
  type_modes,
154
  video,
155
+ examples,
156
  calculate_pt_scores,
157
  clear_app,
158
  pt_scores,
 
299
  )
300
  examples.click(
301
  fn=event_handler_examples_blocks,
302
+ inputs=[languages, type_modes],
303
  outputs=[
304
  notifications,
305
  files,
 
 
 
306
  video,
307
  calculate_pt_scores,
308
  clear_app,
app/event_handlers/examples_blocks.py CHANGED
@@ -27,7 +27,7 @@ from app.components import (
27
  from app.utils import get_language_settings
28
 
29
 
30
- def event_handler_examples_blocks(language):
31
  lang_id, _ = get_language_settings(language)
32
 
33
  first_practical_task = next(iter(supported_practical_tasks[lang_id]))
@@ -38,39 +38,34 @@ def event_handler_examples_blocks(language):
38
  key=lambda x: int(re.search(r"\d+", Path(x).stem).group()),
39
  )
40
 
41
- files_ui = files_create_ui(
42
- value=video_files,
43
- label="{} ({})".format(
44
- config_data.OtherMessages_VIDEO_FILES[lang_id],
45
- ", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
46
- ),
47
- file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
48
- )
49
- webcam = gr.Video(interactive=False, visible=False)
50
- switching_modes = button(
51
- config_data.OtherMessages_SWITCHEHG_MODES_ONLINE[lang_id],
52
- True,
53
- 1,
54
- "./images/webcam.ico",
55
- True,
56
- "switching_modes",
57
- )
58
- type_modes_ui = gr.Radio(
59
- choices=config_data.Settings_TYPE_MODES,
60
- value=config_data.Settings_TYPE_MODES[0],
61
- )
62
 
63
  return (
64
  html_message(
65
- config_data.InformationMessages_NOTI_VIDEOS[lang_id],
66
- False,
67
  True,
68
  "notifications",
69
  ),
70
  files_ui,
71
- webcam,
72
- switching_modes,
73
- type_modes_ui,
74
  video_create_ui(
75
  value=video_files[0],
76
  label=config_data.OtherMessages_VIDEO_PLAYER[lang_id],
@@ -78,7 +73,7 @@ def event_handler_examples_blocks(language):
78
  ),
79
  button(
80
  config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
81
- False,
82
  3,
83
  "./images/calculate_pt_scores.ico",
84
  True,
@@ -86,7 +81,7 @@ def event_handler_examples_blocks(language):
86
  ),
87
  button(
88
  config_data.OtherMessages_CLEAR_APP[lang_id],
89
- False,
90
  1,
91
  "./images/clear.ico",
92
  True,
 
27
  from app.utils import get_language_settings
28
 
29
 
30
+ def event_handler_examples_blocks(language, type_modes):
31
  lang_id, _ = get_language_settings(language)
32
 
33
  first_practical_task = next(iter(supported_practical_tasks[lang_id]))
 
38
  key=lambda x: int(re.search(r"\d+", Path(x).stem).group()),
39
  )
40
 
41
+ if type_modes == config_data.Settings_TYPE_MODES[0]:
42
+ files_ui = files_create_ui(
43
+ value=video_files,
44
+ label="{} ({})".format(
45
+ config_data.OtherMessages_VIDEO_FILES[lang_id],
46
+ ", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
47
+ ),
48
+ file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
49
+ )
50
+ elif type_modes == config_data.Settings_TYPE_MODES[1]:
51
+ files_ui = files_create_ui(
52
+ label="{} ({})".format(
53
+ config_data.OtherMessages_VIDEO_FILES[lang_id],
54
+ ", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
55
+ ),
56
+ file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
57
+ interactive=False,
58
+ visible=False,
59
+ )
 
 
60
 
61
  return (
62
  html_message(
63
+ config_data.OtherMessages_NOTI_CALCULATE[lang_id],
64
+ True,
65
  True,
66
  "notifications",
67
  ),
68
  files_ui,
 
 
 
69
  video_create_ui(
70
  value=video_files[0],
71
  label=config_data.OtherMessages_VIDEO_PLAYER[lang_id],
 
73
  ),
74
  button(
75
  config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
76
+ True,
77
  3,
78
  "./images/calculate_pt_scores.ico",
79
  True,
 
81
  ),
82
  button(
83
  config_data.OtherMessages_CLEAR_APP[lang_id],
84
+ True,
85
  1,
86
  "./images/clear.ico",
87
  True,
app/event_handlers/files.py CHANGED
@@ -20,7 +20,11 @@ def event_handler_files(language, files, video, pt_scores):
20
  if not files:
21
  return (
22
  html_message(
23
- config_data.InformationMessages_NOTI_VIDEOS[lang_id],
 
 
 
 
24
  False,
25
  True,
26
  "notifications",
 
20
  if not files:
21
  return (
22
  html_message(
23
+ (
24
+ config_data.InformationMessages_NOTI_VIDEOS[lang_id].split("(")[0]
25
+ if lang_id == 0
26
+ else config_data.InformationMessages_NOTI_VIDEOS[lang_id]
27
+ ),
28
  False,
29
  True,
30
  "notifications",
app/event_handlers/languages.py CHANGED
@@ -57,6 +57,14 @@ def event_handler_languages(
57
  True,
58
  "switching_modes",
59
  )
 
 
 
 
 
 
 
 
60
  elif type_modes == config_data.Settings_TYPE_MODES[1]:
61
  files_ui = files_create_ui(
62
  label="{} ({})".format(
@@ -76,11 +84,23 @@ def event_handler_languages(
76
  True,
77
  "switching_modes",
78
  )
 
 
 
 
 
 
 
 
79
 
80
  if not video:
81
  video = video_create_ui(label=config_data.OtherMessages_VIDEO_PLAYER[lang_id])
82
  noti_videos = html_message(
83
- config_data.InformationMessages_NOTI_VIDEOS[lang_id],
 
 
 
 
84
  False,
85
  True,
86
  "notifications",
@@ -135,11 +155,11 @@ def event_handler_languages(
135
  else:
136
  practical_task = next(iter(supported_practical_tasks[lang_id]))
137
 
138
- print(current_lang_tasks, "\n")
139
- print(inverse_lang_tasks, "\n")
140
- print(practical_tasks, "\n")
141
- print(supported_practical_tasks, "\n")
142
- print(practical_subtasks, "\n")
143
 
144
  return (
145
  gr.Markdown(value=DESCRIPTIONS[lang_id]),
@@ -164,14 +184,7 @@ def event_handler_languages(
164
  webcam,
165
  switching_modes,
166
  video,
167
- button(
168
- config_data.OtherMessages_EXAMPLES_APP[lang_id],
169
- True,
170
- 1,
171
- "./images/examples.ico",
172
- True,
173
- "examples_oceanai",
174
- ),
175
  button(
176
  config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
177
  True if files else False,
 
57
  True,
58
  "switching_modes",
59
  )
60
+ examples = button(
61
+ config_data.OtherMessages_EXAMPLES_APP[lang_id],
62
+ True,
63
+ 1,
64
+ "./images/examples.ico",
65
+ True,
66
+ "examples_oceanai",
67
+ )
68
  elif type_modes == config_data.Settings_TYPE_MODES[1]:
69
  files_ui = files_create_ui(
70
  label="{} ({})".format(
 
84
  True,
85
  "switching_modes",
86
  )
87
+ examples = button(
88
+ config_data.OtherMessages_EXAMPLE_APP[lang_id],
89
+ True,
90
+ 1,
91
+ "./images/examples.ico",
92
+ True,
93
+ "examples_oceanai",
94
+ )
95
 
96
  if not video:
97
  video = video_create_ui(label=config_data.OtherMessages_VIDEO_PLAYER[lang_id])
98
  noti_videos = html_message(
99
+ (
100
+ config_data.InformationMessages_NOTI_VIDEOS[lang_id].split("(")[0]
101
+ if lang_id == 0
102
+ else config_data.InformationMessages_NOTI_VIDEOS[lang_id]
103
+ ),
104
  False,
105
  True,
106
  "notifications",
 
155
  else:
156
  practical_task = next(iter(supported_practical_tasks[lang_id]))
157
 
158
+ # print(current_lang_tasks, "\n")
159
+ # print(inverse_lang_tasks, "\n")
160
+ # print(practical_tasks, "\n")
161
+ # print(supported_practical_tasks, "\n")
162
+ # print(practical_subtasks, "\n")
163
 
164
  return (
165
  gr.Markdown(value=DESCRIPTIONS[lang_id]),
 
184
  webcam,
185
  switching_modes,
186
  video,
187
+ examples,
 
 
 
 
 
 
 
188
  button(
189
  config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
190
  True if files else False,
app/event_handlers/practical_subtasks.py CHANGED
@@ -352,11 +352,20 @@ def event_handler_practical_subtasks(
352
  number_create_ui(
353
  value=1,
354
  minimum=1,
355
- maximum=df_correlation_coefficients.columns.size,
 
 
 
 
356
  step=1,
357
  label=config_data.Labels_NUMBER_PRIORITY_LABEL,
358
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(
359
- 1, df_correlation_coefficients.columns.size
 
 
 
 
 
360
  ),
361
  show_label=True,
362
  interactive=True,
 
352
  number_create_ui(
353
  value=1,
354
  minimum=1,
355
+ maximum=(
356
+ df_correlation_coefficients.columns.size
357
+ if practical_subtasks.lower() == "car characteristics"
358
+ else df_correlation_coefficients.columns.size - 1
359
+ ),
360
  step=1,
361
  label=config_data.Labels_NUMBER_PRIORITY_LABEL,
362
  info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(
363
+ 1,
364
+ (
365
+ df_correlation_coefficients.columns.size
366
+ if practical_subtasks.lower() == "car characteristics"
367
+ else df_correlation_coefficients.columns.size - 1
368
+ ),
369
  ),
370
  show_label=True,
371
  interactive=True,
app/event_handlers/practical_tasks.py CHANGED
@@ -21,7 +21,7 @@ def event_handler_practical_tasks(
21
  supported_practical_tasks_ren = supported_practical_tasks
22
  elif type_modes == config_data.Settings_TYPE_MODES[1]:
23
  rename_map = {
24
- "Ranking potential candidates by professional responsibilities": "Determine professional possibilities",
25
  "Ранжирование потенциальных кандидатов по профессиональным обязанностям": "Определить профессиональные возможности",
26
  }
27
 
 
21
  supported_practical_tasks_ren = supported_practical_tasks
22
  elif type_modes == config_data.Settings_TYPE_MODES[1]:
23
  rename_map = {
24
+ "Ranking potential candidates by professional responsibilities": "Estimating professional abilities",
25
  "Ранжирование потенциальных кандидатов по профессиональным обязанностям": "Определить профессиональные возможности",
26
  }
27
 
app/event_handlers/switching_modes.py CHANGED
@@ -31,6 +31,16 @@ def event_handler_switching_modes(language, type_modes):
31
  first_practical_task = next(iter(supported_practical_tasks[lang_id]))
32
 
33
  if type_modes == config_data.Settings_TYPE_MODES[0]:
 
 
 
 
 
 
 
 
 
 
34
  files_ui = files_create_ui(
35
  label="{} ({})".format(
36
  config_data.OtherMessages_VIDEO_FILES[lang_id],
@@ -53,7 +63,21 @@ def event_handler_switching_modes(language, type_modes):
53
  choices=config_data.Settings_TYPE_MODES,
54
  value=config_data.Settings_TYPE_MODES[1],
55
  )
 
 
 
 
 
 
 
 
56
  elif type_modes == config_data.Settings_TYPE_MODES[1]:
 
 
 
 
 
 
57
  files_ui = files_create_ui(
58
  label="{} ({})".format(
59
  config_data.OtherMessages_VIDEO_FILES[lang_id],
@@ -74,19 +98,23 @@ def event_handler_switching_modes(language, type_modes):
74
  choices=config_data.Settings_TYPE_MODES,
75
  value=config_data.Settings_TYPE_MODES[0],
76
  )
 
 
 
 
 
 
 
 
77
 
78
  return (
79
- html_message(
80
- config_data.InformationMessages_NOTI_VIDEOS[lang_id],
81
- False,
82
- True,
83
- "notifications",
84
- ),
85
  files_ui,
86
  webcam,
87
  switching_modes,
88
  type_modes_ui,
89
  video_create_ui(),
 
90
  button(
91
  config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
92
  False,
 
31
  first_practical_task = next(iter(supported_practical_tasks[lang_id]))
32
 
33
  if type_modes == config_data.Settings_TYPE_MODES[0]:
34
+ notifications = html_message(
35
+ (
36
+ config_data.InformationMessages_NOTI_VIDEOS[lang_id].split("(")[0]
37
+ if lang_id == 0
38
+ else config_data.InformationMessages_NOTI_VIDEOS[lang_id]
39
+ ),
40
+ False,
41
+ True,
42
+ "notifications",
43
+ )
44
  files_ui = files_create_ui(
45
  label="{} ({})".format(
46
  config_data.OtherMessages_VIDEO_FILES[lang_id],
 
63
  choices=config_data.Settings_TYPE_MODES,
64
  value=config_data.Settings_TYPE_MODES[1],
65
  )
66
+ examples = button(
67
+ config_data.OtherMessages_EXAMPLE_APP[lang_id],
68
+ True,
69
+ 1,
70
+ "./images/examples.ico",
71
+ True,
72
+ "examples_oceanai",
73
+ )
74
  elif type_modes == config_data.Settings_TYPE_MODES[1]:
75
+ notifications = html_message(
76
+ config_data.InformationMessages_NOTI_VIDEOS[lang_id],
77
+ False,
78
+ True,
79
+ "notifications",
80
+ )
81
  files_ui = files_create_ui(
82
  label="{} ({})".format(
83
  config_data.OtherMessages_VIDEO_FILES[lang_id],
 
98
  choices=config_data.Settings_TYPE_MODES,
99
  value=config_data.Settings_TYPE_MODES[0],
100
  )
101
+ examples = button(
102
+ config_data.OtherMessages_EXAMPLES_APP[lang_id],
103
+ True,
104
+ 1,
105
+ "./images/examples.ico",
106
+ True,
107
+ "examples_oceanai",
108
+ )
109
 
110
  return (
111
+ notifications,
 
 
 
 
 
112
  files_ui,
113
  webcam,
114
  switching_modes,
115
  type_modes_ui,
116
  video_create_ui(),
117
+ examples,
118
  button(
119
  config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
120
  False,
app/event_handlers/webcam.py CHANGED
@@ -20,7 +20,11 @@ def event_handler_webcam(language, webcam, pt_scores):
20
  if not webcam:
21
  return (
22
  html_message(
23
- config_data.InformationMessages_NOTI_VIDEOS[lang_id],
 
 
 
 
24
  False,
25
  True,
26
  "notifications",
 
20
  if not webcam:
21
  return (
22
  html_message(
23
+ (
24
+ config_data.InformationMessages_NOTI_VIDEOS[lang_id].split("(")[0]
25
+ if lang_id == 0
26
+ else config_data.InformationMessages_NOTI_VIDEOS[lang_id]
27
+ ),
28
  False,
29
  True,
30
  "notifications",
config.toml CHANGED
@@ -1,5 +1,5 @@
1
  [AppSettings]
2
- APP_VERSION = "0.10.6"
3
  SERVER_NAME = "127.0.0.1"
4
  PORT = 7860
5
  CSS_PATH = "app.css"
@@ -44,6 +44,7 @@ CALCULATE_PT_SCORES_ERR = [
44
  CALCULATE_PRACTICAL_TASK = "Solving practical task"
45
  CLEAR_APP = ["Clear", "Сброс"]
46
  EXAMPLES_APP = ["Examples", "Примеры"]
 
47
  EXPORT_PT_SCORES = [
48
  "Export Big Five personality traits to a CSV file",
49
  "Экспорт показателей Большой пятерки персональных качеств личности человека в CSV файл"]
@@ -53,7 +54,7 @@ EXPORT_WT = "Export ranking effective work teams results to a CSV file"
53
  EXPORT_CP = "Export consumer preferences for industrial goods results to a CSV file"
54
  EXPORT_MBTI = "Export ranking personality type results to a CSV file"
55
  NOTI_CALCULATE = ["You can calculate Big Five personality traits scores", "Вы можете рассчитать показатели Большой пятерки персональных качеств личности человека"]
56
- SWITCHEHG_MODES_ONLINE = ["Webcam", "Веб камера"]
57
  SWITCHEHG_MODES_OFFLINE = ["Video Files", "Видеофайлы"]
58
 
59
  [Labels]
 
1
  [AppSettings]
2
+ APP_VERSION = "0.10.7"
3
  SERVER_NAME = "127.0.0.1"
4
  PORT = 7860
5
  CSS_PATH = "app.css"
 
44
  CALCULATE_PRACTICAL_TASK = "Solving practical task"
45
  CLEAR_APP = ["Clear", "Сброс"]
46
  EXAMPLES_APP = ["Examples", "Примеры"]
47
+ EXAMPLE_APP = ["Example", "Пример"]
48
  EXPORT_PT_SCORES = [
49
  "Export Big Five personality traits to a CSV file",
50
  "Экспорт показателей Большой пятерки персональных качеств личности человека в CSV файл"]
 
54
  EXPORT_CP = "Export consumer preferences for industrial goods results to a CSV file"
55
  EXPORT_MBTI = "Export ranking personality type results to a CSV file"
56
  NOTI_CALCULATE = ["You can calculate Big Five personality traits scores", "Вы можете рассчитать показатели Большой пятерки персональных качеств личности человека"]
57
+ SWITCHEHG_MODES_ONLINE = ["Webcam", "Веб-камера"]
58
  SWITCHEHG_MODES_OFFLINE = ["Video Files", "Видеофайлы"]
59
 
60
  [Labels]
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- gradio==5.7.1
2
  PyYAML==6.0.2
3
  toml==0.10.2
4
  oceanai==1.0.0a46
 
1
+ gradio==5.8.0
2
  PyYAML==6.0.2
3
  toml==0.10.2
4
  oceanai==1.0.0a46