Spaces:
Running
Running
v0.11.0
#34
by
DmitryRyumin
- opened
- .gradio/certificate.pem +31 -0
- README.md +1 -1
- app.css +29 -3
- app.py +16 -2
- app/authors.py +1 -1
- app/components.py +10 -3
- app/data_init.py +16 -0
- app/event_handlers/calculate_practical_tasks.py +457 -176
- app/event_handlers/calculate_pt_scores_blocks.py +78 -29
- app/event_handlers/clear_blocks.py +42 -14
- app/event_handlers/dropdown_candidates.py +3 -6
- app/event_handlers/event_handlers.py +167 -10
- app/event_handlers/examples_blocks.py +162 -10
- app/event_handlers/files.py +13 -3
- app/event_handlers/languages.py +118 -18
- app/event_handlers/practical_subtasks.py +58 -39
- app/event_handlers/practical_task_sorted.py +20 -9
- app/event_handlers/practical_tasks.py +22 -4
- app/event_handlers/switching_modes.py +226 -0
- app/event_handlers/webcam.py +84 -0
- app/port.py +35 -0
- app/practical_tasks.py +18 -8
- app/tabs.py +91 -27
- app/utils.py +26 -0
- config.toml +21 -7
- images/videos.ico +0 -0
- images/webcam.ico +0 -0
- practical_tasks.yaml → practical_tasks_en.yaml +2 -1
- practical_tasks_ru.yaml +15 -0
- requirements.txt +6 -4
.gradio/certificate.pem
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-----BEGIN CERTIFICATE-----
|
2 |
+
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
|
3 |
+
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
4 |
+
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
|
5 |
+
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
|
6 |
+
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
|
7 |
+
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
|
8 |
+
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
|
9 |
+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
|
10 |
+
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
|
11 |
+
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
|
12 |
+
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
|
13 |
+
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
|
14 |
+
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
|
15 |
+
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
|
16 |
+
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
|
17 |
+
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
|
18 |
+
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
|
19 |
+
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
|
20 |
+
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
|
21 |
+
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
|
22 |
+
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
|
23 |
+
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
|
24 |
+
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
|
25 |
+
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
|
26 |
+
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
|
27 |
+
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
|
28 |
+
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
|
29 |
+
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
30 |
+
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
31 |
+
-----END CERTIFICATE-----
|
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 😀🤓😎😉😤
|
|
4 |
colorFrom: gray
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 5.
|
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
@@ -14,9 +14,8 @@ div.app-flex-container {
|
|
14 |
gap: 6px;
|
15 |
}
|
16 |
|
17 |
-
div.
|
18 |
-
|
19 |
-
max-height: 350px;
|
20 |
}
|
21 |
|
22 |
div.video-column-container {
|
@@ -28,11 +27,17 @@ div.video-sorted-container {
|
|
28 |
max-height: 350px;
|
29 |
}
|
30 |
|
|
|
31 |
div.files-container {
|
32 |
height: 350px;
|
33 |
max-height: 350px;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
36 |
div.files-container tr {
|
37 |
padding-right: 20px;
|
38 |
}
|
@@ -42,6 +47,8 @@ div.video-sorted-container div.icon-buttons > button {
|
|
42 |
display: none;
|
43 |
}
|
44 |
|
|
|
|
|
45 |
div.files-container:hover label[data-testid="block-label"],
|
46 |
div.video-container:hover label[data-testid="block-label"],
|
47 |
div.video-sorted-container:hover label[data-testid="block-label"] {
|
@@ -58,11 +65,14 @@ div.dataframe div.table-wrap {
|
|
58 |
height: auto !important;
|
59 |
}
|
60 |
|
|
|
61 |
div.files-container div.file-preview-holder {
|
62 |
overflow-y: scroll;
|
63 |
height: 100%;
|
64 |
}
|
65 |
|
|
|
|
|
66 |
div.files-container label[data-testid="block-label"] {
|
67 |
position: absolute;
|
68 |
}
|
@@ -130,6 +140,10 @@ div.files-container label[data-testid="block-label"] {
|
|
130 |
max-width: fit-content;
|
131 |
}
|
132 |
|
|
|
|
|
|
|
|
|
133 |
div.languages-container_wrapper {
|
134 |
display: grid;
|
135 |
justify-content: end;
|
@@ -169,6 +183,10 @@ div.languages-container > div.country_flags div.image-container > button > div.i
|
|
169 |
height: 32px;
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
172 |
.dropdown-language-container {
|
173 |
display: contents;
|
174 |
}
|
@@ -247,6 +265,14 @@ div.surname-container > div.metadata_surname-logo div.image-container,
|
|
247 |
div.email-container > div.metadata_email-logo div.image-container,
|
248 |
div.phone-container > div.metadata_phone-logo div.image-container {
|
249 |
width: fit-content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
|
252 |
div.name-container > div.metadata_name-logo div.image-container > button > div > img,
|
|
|
14 |
gap: 6px;
|
15 |
}
|
16 |
|
17 |
+
div.media-container {
|
18 |
+
align-items: stretch;
|
|
|
19 |
}
|
20 |
|
21 |
div.video-column-container {
|
|
|
27 |
max-height: 350px;
|
28 |
}
|
29 |
|
30 |
+
div.webcam,
|
31 |
div.files-container {
|
32 |
height: 350px;
|
33 |
max-height: 350px;
|
34 |
}
|
35 |
|
36 |
+
div.webcam div[data-testid="video"] > div.wrap,
|
37 |
+
div.webcam div[data-testid="video"] > div.upload-container {
|
38 |
+
height: 310px;
|
39 |
+
}
|
40 |
+
|
41 |
div.files-container tr {
|
42 |
padding-right: 20px;
|
43 |
}
|
|
|
47 |
display: none;
|
48 |
}
|
49 |
|
50 |
+
div.webcam:hover label[data-testid="block-label"],
|
51 |
+
div.video-container:hover label[data-testid="block-label"],
|
52 |
div.files-container:hover label[data-testid="block-label"],
|
53 |
div.video-container:hover label[data-testid="block-label"],
|
54 |
div.video-sorted-container:hover label[data-testid="block-label"] {
|
|
|
65 |
height: auto !important;
|
66 |
}
|
67 |
|
68 |
+
div.video-container div.file-preview-holder,
|
69 |
div.files-container div.file-preview-holder {
|
70 |
overflow-y: scroll;
|
71 |
height: 100%;
|
72 |
}
|
73 |
|
74 |
+
div.webcam label[data-testid="block-label"],
|
75 |
+
div.video-container label[data-testid="block-label"],
|
76 |
div.files-container label[data-testid="block-label"] {
|
77 |
position: absolute;
|
78 |
}
|
|
|
140 |
max-width: fit-content;
|
141 |
}
|
142 |
|
143 |
+
div.notifications {
|
144 |
+
height: 85px;
|
145 |
+
}
|
146 |
+
|
147 |
div.languages-container_wrapper {
|
148 |
display: grid;
|
149 |
justify-content: end;
|
|
|
183 |
height: 32px;
|
184 |
}
|
185 |
|
186 |
+
div.languages-container > div.country_flags div.image-container > div.icon-button-wrapper {
|
187 |
+
display: none;
|
188 |
+
}
|
189 |
+
|
190 |
.dropdown-language-container {
|
191 |
display: contents;
|
192 |
}
|
|
|
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
@@ -12,12 +12,15 @@ from app.config import CONFIG_NAME, config_data, load_tab_creators
|
|
12 |
from app.event_handlers.event_handlers import setup_app_event_handlers
|
13 |
from app import tabs
|
14 |
from app.components import dropdown_create_ui
|
|
|
15 |
|
16 |
gr.set_static_paths(paths=[config_data.StaticPaths_IMAGES])
|
17 |
|
18 |
|
19 |
def create_gradio_app() -> gr.Blocks:
|
20 |
-
with gr.Blocks(
|
|
|
|
|
21 |
with gr.Column(
|
22 |
visible=True,
|
23 |
render=True,
|
@@ -39,6 +42,7 @@ def create_gradio_app() -> gr.Blocks:
|
|
39 |
visible=True,
|
40 |
show_download_button=False,
|
41 |
elem_classes="country_flags",
|
|
|
42 |
)
|
43 |
|
44 |
languages = dropdown_create_ui(
|
@@ -81,4 +85,14 @@ def create_gradio_app() -> gr.Blocks:
|
|
81 |
|
82 |
|
83 |
if __name__ == "__main__":
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
from app.event_handlers.event_handlers import setup_app_event_handlers
|
13 |
from app import tabs
|
14 |
from app.components import dropdown_create_ui
|
15 |
+
from app.port import is_port_in_use, free_ports
|
16 |
|
17 |
gr.set_static_paths(paths=[config_data.StaticPaths_IMAGES])
|
18 |
|
19 |
|
20 |
def create_gradio_app() -> gr.Blocks:
|
21 |
+
with gr.Blocks(
|
22 |
+
theme=gr.themes.Default(), css_paths=config_data.AppSettings_CSS_PATH
|
23 |
+
) as gradio_app:
|
24 |
with gr.Column(
|
25 |
visible=True,
|
26 |
render=True,
|
|
|
42 |
visible=True,
|
43 |
show_download_button=False,
|
44 |
elem_classes="country_flags",
|
45 |
+
show_fullscreen_button=False,
|
46 |
)
|
47 |
|
48 |
languages = dropdown_create_ui(
|
|
|
85 |
|
86 |
|
87 |
if __name__ == "__main__":
|
88 |
+
ports_to_check = [config_data.AppSettings_PORT]
|
89 |
+
|
90 |
+
for port in filter(None, ports_to_check):
|
91 |
+
if is_port_in_use(config_data.AppSettings_SERVER_NAME, port):
|
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 |
+
)
|
app/authors.py
CHANGED
@@ -76,7 +76,7 @@ AUTHORS = """
|
|
76 |
<a href="https://github.com/DmitryRyumin" style="display: inline-block;">
|
77 |
<img src="https://github-stats-alpha.vercel.app/api?username=DmitryRyumin&cc=3081F7&tc=FFFFFF&ic=FFFFFF&bc=FFFFFF" alt="" />
|
78 |
</a>
|
79 |
-
<div style="display: flex; flex-wrap: wrap;">
|
80 |
<img src="https://custom-icon-badges.demolab.com/badge/dynamic/json?style=flat-square&logo=fire&logoColor=fff&color=orange&label=GitHub%20streak&query=%24.currentStreak.length&suffix=%20days&url=https%3A%2F%2Fstreak-stats.demolab.com%2F%3Fuser%3Ddmitryryumin%26type%3Djson" alt="" style="margin-right: 6px; margin-bottom: 6px;" />
|
81 |
<img src="https://komarev.com/ghpvc/?username=DmitryRyumin&style=flat-square" alt="" style="margin-bottom: 6px;" />
|
82 |
</div>
|
|
|
76 |
<a href="https://github.com/DmitryRyumin" style="display: inline-block;">
|
77 |
<img src="https://github-stats-alpha.vercel.app/api?username=DmitryRyumin&cc=3081F7&tc=FFFFFF&ic=FFFFFF&bc=FFFFFF" alt="" />
|
78 |
</a>
|
79 |
+
<div style="display: flex; flex-wrap: wrap; align-items: flex-start;">
|
80 |
<img src="https://custom-icon-badges.demolab.com/badge/dynamic/json?style=flat-square&logo=fire&logoColor=fff&color=orange&label=GitHub%20streak&query=%24.currentStreak.length&suffix=%20days&url=https%3A%2F%2Fstreak-stats.demolab.com%2F%3Fuser%3Ddmitryryumin%26type%3Djson" alt="" style="margin-right: 6px; margin-bottom: 6px;" />
|
81 |
<img src="https://komarev.com/ghpvc/?username=DmitryRyumin&style=flat-square" alt="" style="margin-bottom: 6px;" />
|
82 |
</div>
|
app/components.py
CHANGED
@@ -13,11 +13,18 @@ from app.config import config_data
|
|
13 |
|
14 |
|
15 |
def html_message(
|
16 |
-
message: str = "",
|
|
|
|
|
|
|
17 |
) -> gr.HTML:
|
18 |
css_class = "noti_err" if not error else "noti_true"
|
19 |
|
20 |
-
return gr.HTML(
|
|
|
|
|
|
|
|
|
21 |
|
22 |
|
23 |
def files_create_ui(
|
@@ -53,7 +60,7 @@ def video_create_ui(
|
|
53 |
show_label: bool = True,
|
54 |
interactive: bool = False,
|
55 |
visible: bool = True,
|
56 |
-
elem_classes: Optional[str] = "
|
57 |
) -> gr.Video:
|
58 |
if file_name is not None:
|
59 |
label += f" ({file_name})"
|
|
|
13 |
|
14 |
|
15 |
def html_message(
|
16 |
+
message: str = "",
|
17 |
+
error: bool = True,
|
18 |
+
visible: bool = True,
|
19 |
+
elem_classes: Optional[str] = "html-container",
|
20 |
) -> gr.HTML:
|
21 |
css_class = "noti_err" if not error else "noti_true"
|
22 |
|
23 |
+
return gr.HTML(
|
24 |
+
value=f"<h3 class='{css_class}'>{message}</h3>",
|
25 |
+
visible=visible,
|
26 |
+
elem_classes=elem_classes,
|
27 |
+
)
|
28 |
|
29 |
|
30 |
def files_create_ui(
|
|
|
60 |
show_label: bool = True,
|
61 |
interactive: bool = False,
|
62 |
visible: bool = True,
|
63 |
+
elem_classes: Optional[str] = "video-container",
|
64 |
) -> gr.Video:
|
65 |
if file_name is not None:
|
66 |
label += f" ({file_name})"
|
app/data_init.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
File: data_init.py
|
3 |
+
Author: Elena Ryumina and Dmitry Ryumin
|
4 |
+
Description: Data initialization.
|
5 |
+
License: MIT License
|
6 |
+
"""
|
7 |
+
|
8 |
+
from app.config import config_data
|
9 |
+
from app.utils import read_csv_file, extract_profession_weights
|
10 |
+
|
11 |
+
|
12 |
+
df_traits_priority_for_professions = read_csv_file(config_data.Links_PROFESSIONS)
|
13 |
+
weights_professions, interactive_professions = extract_profession_weights(
|
14 |
+
df_traits_priority_for_professions,
|
15 |
+
config_data.Settings_DROPDOWN_CANDIDATES[0],
|
16 |
+
)
|
app/event_handlers/calculate_practical_tasks.py
CHANGED
@@ -6,18 +6,23 @@ License: MIT License
|
|
6 |
"""
|
7 |
|
8 |
from app.oceanai_init import b5
|
|
|
9 |
import re
|
10 |
import gradio as gr
|
11 |
from pathlib import Path
|
|
|
12 |
|
13 |
# Importing necessary components for the Gradio app
|
14 |
from app.config import config_data
|
15 |
from app.video_metadata import video_metadata
|
16 |
from app.mbti_description import MBTI_DESCRIPTION, MBTI_DATA
|
|
|
17 |
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,7 +171,10 @@ def create_person_metadata(person_id, files, video_metadata):
|
|
166 |
|
167 |
|
168 |
def event_handler_calculate_practical_task_blocks(
|
|
|
|
|
169 |
files,
|
|
|
170 |
practical_subtasks,
|
171 |
pt_scores,
|
172 |
dropdown_mbti,
|
@@ -188,6 +196,11 @@ def event_handler_calculate_practical_task_blocks(
|
|
188 |
number_agreeableness,
|
189 |
number_non_neuroticism,
|
190 |
):
|
|
|
|
|
|
|
|
|
|
|
191 |
if practical_subtasks.lower() == "16 personality types of mbti":
|
192 |
df_correlation_coefficients = read_csv_file(config_data.Links_MBTI)
|
193 |
|
@@ -195,44 +208,107 @@ def event_handler_calculate_practical_task_blocks(
|
|
195 |
|
196 |
preprocess_scores_df(pt_scores_copy, config_data.Dataframes_PT_SCORES[0][0])
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
205 |
|
206 |
-
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
|
222 |
-
|
|
|
|
|
|
|
|
|
223 |
|
224 |
-
|
225 |
|
226 |
-
|
|
|
|
|
227 |
|
228 |
-
|
229 |
-
|
230 |
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
|
237 |
existing_tuple = (
|
238 |
gr.Row(visible=True),
|
@@ -277,122 +353,235 @@ def event_handler_calculate_practical_task_blocks(
|
|
277 |
|
278 |
return existing_tuple[:-1] + person_metadata + existing_tuple[-1:]
|
279 |
elif practical_subtasks.lower() == "professional groups":
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
if sum_weights != 100:
|
291 |
-
gr.Warning(config_data.InformationMessages_SUM_WEIGHTS.format(sum_weights))
|
292 |
-
|
293 |
-
return (
|
294 |
-
gr.Row(visible=False),
|
295 |
-
gr.Column(visible=False),
|
296 |
-
dataframe(visible=False),
|
297 |
-
files_create_ui(
|
298 |
-
None,
|
299 |
-
"single",
|
300 |
-
[".csv"],
|
301 |
-
config_data.OtherMessages_EXPORT_PS,
|
302 |
-
True,
|
303 |
-
False,
|
304 |
-
False,
|
305 |
-
"csv-container",
|
306 |
-
),
|
307 |
-
gr.Accordion(visible=False),
|
308 |
-
gr.HTML(visible=False),
|
309 |
-
dataframe(visible=False),
|
310 |
-
gr.Column(visible=False),
|
311 |
-
video_create_ui(visible=False),
|
312 |
-
gr.Column(visible=False),
|
313 |
-
gr.Row(visible=False),
|
314 |
-
gr.Row(visible=False),
|
315 |
-
gr.Image(visible=False),
|
316 |
-
textbox_create_ui(visible=False),
|
317 |
-
gr.Row(visible=False),
|
318 |
-
gr.Image(visible=False),
|
319 |
-
textbox_create_ui(visible=False),
|
320 |
-
gr.Row(visible=False),
|
321 |
-
gr.Row(visible=False),
|
322 |
-
gr.Image(visible=False),
|
323 |
-
textbox_create_ui(visible=False),
|
324 |
-
gr.Row(visible=False),
|
325 |
-
gr.Image(visible=False),
|
326 |
-
textbox_create_ui(visible=False),
|
327 |
-
html_message(
|
328 |
-
config_data.InformationMessages_SUM_WEIGHTS.format(sum_weights),
|
329 |
-
False,
|
330 |
-
True,
|
331 |
-
),
|
332 |
-
)
|
333 |
-
else:
|
334 |
-
b5._candidate_ranking(
|
335 |
-
df_files=pt_scores.iloc[:, 1:],
|
336 |
-
weigths_openness=number_openness,
|
337 |
-
weigths_conscientiousness=number_conscientiousness,
|
338 |
-
weigths_extraversion=number_extraversion,
|
339 |
-
weigths_agreeableness=number_agreeableness,
|
340 |
-
weigths_non_neuroticism=number_non_neuroticism,
|
341 |
-
out=False,
|
342 |
-
)
|
343 |
-
|
344 |
-
df = apply_rounding_and_rename_columns(b5.df_files_ranking_)
|
345 |
-
|
346 |
-
df_hidden = df.drop(columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS)
|
347 |
-
|
348 |
-
df_hidden.to_csv(config_data.Filenames_POTENTIAL_CANDIDATES)
|
349 |
-
|
350 |
-
df_hidden.reset_index(inplace=True)
|
351 |
-
|
352 |
-
person_id = (
|
353 |
-
int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
354 |
)
|
355 |
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
|
390 |
-
|
391 |
elif practical_subtasks.lower() == "professional skills":
|
392 |
df_professional_skills = read_csv_file(config_data.Links_PROFESSIONAL_SKILLS)
|
393 |
|
|
|
|
|
|
|
|
|
394 |
b5._priority_skill_calculation(
|
395 |
-
df_files=
|
396 |
correlation_coefficients=df_professional_skills,
|
397 |
threshold=threshold_professional_skills,
|
398 |
out=False,
|
@@ -400,26 +589,44 @@ def event_handler_calculate_practical_task_blocks(
|
|
400 |
|
401 |
df = apply_rounding_and_rename_columns(b5.df_files_priority_skill_)
|
402 |
|
403 |
-
|
404 |
-
|
405 |
-
|
|
|
406 |
|
407 |
-
|
|
|
|
|
|
|
|
|
|
|
408 |
|
409 |
df_hidden = df.drop(
|
410 |
columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS
|
411 |
+ professional_skills_list
|
|
|
412 |
)
|
413 |
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
|
418 |
-
df_hidden
|
419 |
-
by=[dropdown_professional_skills], ascending=False
|
420 |
-
)
|
421 |
|
422 |
-
|
|
|
|
|
|
|
|
|
|
|
423 |
|
424 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
425 |
|
@@ -459,37 +666,83 @@ def event_handler_calculate_practical_task_blocks(
|
|
459 |
elif (
|
460 |
practical_subtasks.lower() == "finding a suitable junior colleague"
|
461 |
or practical_subtasks.lower() == "finding a suitable senior colleague"
|
|
|
|
|
462 |
):
|
463 |
-
|
464 |
-
config_data.Links_FINDING_COLLEAGUE, ["ID"]
|
465 |
-
)
|
466 |
|
467 |
-
|
468 |
-
df_files=pt_scores.iloc[:, 1:],
|
469 |
-
correlation_coefficients=df_correlation_coefficients,
|
470 |
-
target_scores=[
|
471 |
-
target_score_ope,
|
472 |
-
target_score_con,
|
473 |
-
target_score_ext,
|
474 |
-
target_score_agr,
|
475 |
-
target_score_nneu,
|
476 |
-
],
|
477 |
-
colleague=colleague_type(practical_subtasks),
|
478 |
-
equal_coefficients=equal_coefficient,
|
479 |
-
out=False,
|
480 |
-
)
|
481 |
|
482 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
|
484 |
-
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
|
490 |
df_hidden.reset_index(inplace=True)
|
491 |
|
492 |
-
person_id =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
|
494 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
495 |
|
@@ -530,7 +783,7 @@ def event_handler_calculate_practical_task_blocks(
|
|
530 |
elif (
|
531 |
practical_subtasks.lower() == "car characteristics"
|
532 |
or practical_subtasks.lower() == "mobile device application categories"
|
533 |
-
or practical_subtasks.lower() == "clothing
|
534 |
):
|
535 |
if practical_subtasks.lower() == "car characteristics":
|
536 |
df_correlation_coefficients = read_csv_file(
|
@@ -541,9 +794,13 @@ def event_handler_calculate_practical_task_blocks(
|
|
541 |
df_correlation_coefficients = read_csv_file(
|
542 |
config_data.Links_MDA_CATEGORIES
|
543 |
)
|
544 |
-
elif practical_subtasks.lower() == "clothing
|
545 |
df_correlation_coefficients = read_csv_file(config_data.Links_CLOTHING_SC)
|
546 |
|
|
|
|
|
|
|
|
|
547 |
pt_scores_copy = pt_scores.iloc[:, 1:].copy()
|
548 |
|
549 |
preprocess_scores_df(pt_scores_copy, config_data.Dataframes_PT_SCORES[0][0])
|
@@ -565,13 +822,37 @@ def event_handler_calculate_practical_task_blocks(
|
|
565 |
|
566 |
preprocess_scores_df(df, config_data.Dataframes_PT_SCORES[0][0])
|
567 |
|
568 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
|
570 |
df_hidden.to_csv(consumer_preferences(practical_subtasks))
|
571 |
|
572 |
-
df_hidden.reset_index(
|
|
|
|
|
|
|
573 |
|
574 |
-
|
|
|
|
|
|
|
|
|
|
|
575 |
|
576 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
577 |
|
|
|
6 |
"""
|
7 |
|
8 |
from app.oceanai_init import b5
|
9 |
+
import pandas as pd
|
10 |
import re
|
11 |
import gradio as gr
|
12 |
from pathlib import Path
|
13 |
+
from bs4 import BeautifulSoup
|
14 |
|
15 |
# Importing necessary components for the Gradio app
|
16 |
from app.config import config_data
|
17 |
from app.video_metadata import video_metadata
|
18 |
from app.mbti_description import MBTI_DESCRIPTION, MBTI_DATA
|
19 |
+
from app.data_init import df_traits_priority_for_professions
|
20 |
from app.utils import (
|
21 |
read_csv_file,
|
22 |
apply_rounding_and_rename_columns,
|
23 |
preprocess_scores_df,
|
24 |
+
get_language_settings,
|
25 |
+
extract_profession_weights,
|
26 |
)
|
27 |
from app.components import (
|
28 |
html_message,
|
|
|
171 |
|
172 |
|
173 |
def event_handler_calculate_practical_task_blocks(
|
174 |
+
language,
|
175 |
+
type_modes,
|
176 |
files,
|
177 |
+
video,
|
178 |
practical_subtasks,
|
179 |
pt_scores,
|
180 |
dropdown_mbti,
|
|
|
196 |
number_agreeableness,
|
197 |
number_non_neuroticism,
|
198 |
):
|
199 |
+
lang_id, _ = get_language_settings(language)
|
200 |
+
|
201 |
+
if type_modes == config_data.Settings_TYPE_MODES[1]:
|
202 |
+
files = [video]
|
203 |
+
|
204 |
if practical_subtasks.lower() == "16 personality types of mbti":
|
205 |
df_correlation_coefficients = read_csv_file(config_data.Links_MBTI)
|
206 |
|
|
|
208 |
|
209 |
preprocess_scores_df(pt_scores_copy, config_data.Dataframes_PT_SCORES[0][0])
|
210 |
|
211 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
212 |
+
b5._professional_match(
|
213 |
+
df_files=pt_scores_copy,
|
214 |
+
correlation_coefficients=df_correlation_coefficients,
|
215 |
+
personality_type=remove_parentheses(dropdown_mbti),
|
216 |
+
threshold=threshold_mbti,
|
217 |
+
out=False,
|
218 |
+
)
|
219 |
|
220 |
+
df = apply_rounding_and_rename_columns(b5.df_files_MBTI_job_match_)
|
221 |
|
222 |
+
df_hidden = df.drop(
|
223 |
+
columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS
|
224 |
+
+ config_data.Settings_DROPDOWN_MBTI_DEL_COLS
|
225 |
+
)
|
226 |
|
227 |
+
df_hidden.rename(
|
228 |
+
columns={
|
229 |
+
"Path": "Filename",
|
230 |
+
"MBTI": "Personality Type",
|
231 |
+
"MBTI_Score": "Personality Type Score",
|
232 |
+
},
|
233 |
+
inplace=True,
|
234 |
+
)
|
235 |
|
236 |
+
df_copy = df_hidden.copy()
|
237 |
+
df_copy["Personality Type"] = df_copy["Personality Type"].apply(
|
238 |
+
lambda x: "".join(BeautifulSoup(x, "html.parser").stripped_strings)
|
239 |
+
)
|
240 |
+
df_copy.to_csv(config_data.Filenames_MBTI_JOB, index=False)
|
241 |
|
242 |
+
df_hidden.reset_index(inplace=True)
|
243 |
|
244 |
+
person_id = (
|
245 |
+
int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
246 |
+
)
|
247 |
|
248 |
+
short_mbti = extract_text_in_parentheses(dropdown_mbti)
|
249 |
+
mbti_values = df_hidden["Personality Type"].tolist()
|
250 |
|
251 |
+
df_hidden["Personality Type"] = [
|
252 |
+
compare_strings(short_mbti, mbti, False) for mbti in mbti_values
|
253 |
+
]
|
254 |
|
255 |
+
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
256 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
257 |
+
all_hidden_dfs = []
|
258 |
+
|
259 |
+
for dropdown_mbti in config_data.Settings_DROPDOWN_MBTI:
|
260 |
+
b5._professional_match(
|
261 |
+
df_files=pt_scores_copy,
|
262 |
+
correlation_coefficients=df_correlation_coefficients,
|
263 |
+
personality_type=remove_parentheses(dropdown_mbti),
|
264 |
+
threshold=threshold_mbti,
|
265 |
+
out=False,
|
266 |
+
)
|
267 |
+
|
268 |
+
df = apply_rounding_and_rename_columns(b5.df_files_MBTI_job_match_)
|
269 |
+
|
270 |
+
df_hidden = df.drop(
|
271 |
+
columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS
|
272 |
+
+ config_data.Settings_DROPDOWN_MBTI_DEL_COLS
|
273 |
+
+ config_data.Settings_DROPDOWN_MBTI_DEL_COLS_WEBCAM
|
274 |
+
)
|
275 |
+
|
276 |
+
df_hidden.insert(0, "Popular Occupations", dropdown_mbti)
|
277 |
+
|
278 |
+
df_hidden.rename(
|
279 |
+
columns={
|
280 |
+
"MBTI": "Personality Type",
|
281 |
+
"MBTI_Score": "Personality Type Score",
|
282 |
+
},
|
283 |
+
inplace=True,
|
284 |
+
)
|
285 |
+
|
286 |
+
short_mbti = extract_text_in_parentheses(dropdown_mbti)
|
287 |
+
mbti_values = df_hidden["Personality Type"].tolist()
|
288 |
+
|
289 |
+
df_hidden["Personality Type"] = [
|
290 |
+
compare_strings(short_mbti, mbti, False) for mbti in mbti_values
|
291 |
+
]
|
292 |
+
|
293 |
+
all_hidden_dfs.append(df_hidden)
|
294 |
+
|
295 |
+
df_hidden = pd.concat(all_hidden_dfs, ignore_index=True)
|
296 |
+
|
297 |
+
df_hidden = df_hidden.sort_values(
|
298 |
+
by="Personality Type Score", ascending=False
|
299 |
+
)
|
300 |
+
|
301 |
+
df_hidden.reset_index(drop=True, inplace=True)
|
302 |
+
|
303 |
+
df_copy = df_hidden.copy()
|
304 |
+
df_copy["Personality Type"] = df_copy["Personality Type"].apply(
|
305 |
+
lambda x: "".join(BeautifulSoup(x, "html.parser").stripped_strings)
|
306 |
+
)
|
307 |
+
df_copy.to_csv(config_data.Filenames_MBTI_JOB, index=False)
|
308 |
+
|
309 |
+
person_id = 0
|
310 |
+
|
311 |
+
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
312 |
|
313 |
existing_tuple = (
|
314 |
gr.Row(visible=True),
|
|
|
353 |
|
354 |
return existing_tuple[:-1] + person_metadata + existing_tuple[-1:]
|
355 |
elif practical_subtasks.lower() == "professional groups":
|
356 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
357 |
+
sum_weights = sum(
|
358 |
+
[
|
359 |
+
number_openness,
|
360 |
+
number_conscientiousness,
|
361 |
+
number_extraversion,
|
362 |
+
number_agreeableness,
|
363 |
+
number_non_neuroticism,
|
364 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
)
|
366 |
|
367 |
+
if sum_weights != 100:
|
368 |
+
gr.Warning(
|
369 |
+
config_data.InformationMessages_SUM_WEIGHTS.format(sum_weights)
|
370 |
+
)
|
371 |
+
|
372 |
+
return (
|
373 |
+
gr.Row(visible=False),
|
374 |
+
gr.Column(visible=False),
|
375 |
+
dataframe(visible=False),
|
376 |
+
files_create_ui(
|
377 |
+
None,
|
378 |
+
"single",
|
379 |
+
[".csv"],
|
380 |
+
config_data.OtherMessages_EXPORT_PS,
|
381 |
+
True,
|
382 |
+
False,
|
383 |
+
False,
|
384 |
+
"csv-container",
|
385 |
+
),
|
386 |
+
gr.Accordion(visible=False),
|
387 |
+
gr.HTML(visible=False),
|
388 |
+
dataframe(visible=False),
|
389 |
+
gr.Column(visible=False),
|
390 |
+
video_create_ui(visible=False),
|
391 |
+
gr.Column(visible=False),
|
392 |
+
gr.Row(visible=False),
|
393 |
+
gr.Row(visible=False),
|
394 |
+
gr.Image(visible=False),
|
395 |
+
textbox_create_ui(visible=False),
|
396 |
+
gr.Row(visible=False),
|
397 |
+
gr.Image(visible=False),
|
398 |
+
textbox_create_ui(visible=False),
|
399 |
+
gr.Row(visible=False),
|
400 |
+
gr.Row(visible=False),
|
401 |
+
gr.Image(visible=False),
|
402 |
+
textbox_create_ui(visible=False),
|
403 |
+
gr.Row(visible=False),
|
404 |
+
gr.Image(visible=False),
|
405 |
+
textbox_create_ui(visible=False),
|
406 |
+
html_message(
|
407 |
+
config_data.InformationMessages_SUM_WEIGHTS.format(sum_weights),
|
408 |
+
False,
|
409 |
+
True,
|
410 |
+
),
|
411 |
+
)
|
412 |
+
else:
|
413 |
+
b5._candidate_ranking(
|
414 |
+
df_files=pt_scores.iloc[:, 1:],
|
415 |
+
weigths_openness=number_openness,
|
416 |
+
weigths_conscientiousness=number_conscientiousness,
|
417 |
+
weigths_extraversion=number_extraversion,
|
418 |
+
weigths_agreeableness=number_agreeableness,
|
419 |
+
weigths_non_neuroticism=number_non_neuroticism,
|
420 |
+
out=False,
|
421 |
+
)
|
422 |
+
|
423 |
+
df = apply_rounding_and_rename_columns(b5.df_files_ranking_)
|
424 |
+
|
425 |
+
df_hidden = df.drop(
|
426 |
+
columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS
|
427 |
+
)
|
428 |
+
|
429 |
+
df_hidden.to_csv(config_data.Filenames_POTENTIAL_CANDIDATES)
|
430 |
+
|
431 |
+
df_hidden.reset_index(inplace=True)
|
432 |
+
|
433 |
+
person_id = (
|
434 |
+
int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
435 |
+
)
|
436 |
+
|
437 |
+
person_metadata = create_person_metadata(
|
438 |
+
person_id, files, video_metadata
|
439 |
+
)
|
440 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
441 |
+
all_hidden_dfs = []
|
442 |
+
|
443 |
+
for dropdown_candidate in config_data.Settings_DROPDOWN_CANDIDATES[:-1]:
|
444 |
+
weights, _ = extract_profession_weights(
|
445 |
+
df_traits_priority_for_professions,
|
446 |
+
dropdown_candidate,
|
447 |
+
)
|
448 |
+
|
449 |
+
sum_weights = sum(weights)
|
450 |
+
|
451 |
+
if sum_weights != 100:
|
452 |
+
gr.Warning(
|
453 |
+
config_data.InformationMessages_SUM_WEIGHTS.format(sum_weights)
|
454 |
+
)
|
455 |
+
|
456 |
+
return (
|
457 |
+
gr.Row(visible=False),
|
458 |
+
gr.Column(visible=False),
|
459 |
+
dataframe(visible=False),
|
460 |
+
files_create_ui(
|
461 |
+
None,
|
462 |
+
"single",
|
463 |
+
[".csv"],
|
464 |
+
config_data.OtherMessages_EXPORT_PS,
|
465 |
+
True,
|
466 |
+
False,
|
467 |
+
False,
|
468 |
+
"csv-container",
|
469 |
+
),
|
470 |
+
gr.Accordion(visible=False),
|
471 |
+
gr.HTML(visible=False),
|
472 |
+
dataframe(visible=False),
|
473 |
+
gr.Column(visible=False),
|
474 |
+
video_create_ui(visible=False),
|
475 |
+
gr.Column(visible=False),
|
476 |
+
gr.Row(visible=False),
|
477 |
+
gr.Row(visible=False),
|
478 |
+
gr.Image(visible=False),
|
479 |
+
textbox_create_ui(visible=False),
|
480 |
+
gr.Row(visible=False),
|
481 |
+
gr.Image(visible=False),
|
482 |
+
textbox_create_ui(visible=False),
|
483 |
+
gr.Row(visible=False),
|
484 |
+
gr.Row(visible=False),
|
485 |
+
gr.Image(visible=False),
|
486 |
+
textbox_create_ui(visible=False),
|
487 |
+
gr.Row(visible=False),
|
488 |
+
gr.Image(visible=False),
|
489 |
+
textbox_create_ui(visible=False),
|
490 |
+
html_message(
|
491 |
+
config_data.InformationMessages_SUM_WEIGHTS.format(
|
492 |
+
sum_weights
|
493 |
+
),
|
494 |
+
False,
|
495 |
+
True,
|
496 |
+
),
|
497 |
+
)
|
498 |
+
else:
|
499 |
+
b5._candidate_ranking(
|
500 |
+
df_files=pt_scores.iloc[:, 1:],
|
501 |
+
weigths_openness=weights[0],
|
502 |
+
weigths_conscientiousness=weights[1],
|
503 |
+
weigths_extraversion=weights[2],
|
504 |
+
weigths_agreeableness=weights[3],
|
505 |
+
weigths_non_neuroticism=weights[4],
|
506 |
+
out=False,
|
507 |
+
)
|
508 |
+
|
509 |
+
df = apply_rounding_and_rename_columns(b5.df_files_ranking_)
|
510 |
+
|
511 |
+
df_hidden = df.drop(
|
512 |
+
columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS
|
513 |
+
+ config_data.Settings_DROPDOWN_MBTI_DEL_COLS_WEBCAM
|
514 |
+
)
|
515 |
+
|
516 |
+
df_hidden.insert(0, "Professional Group", dropdown_candidate)
|
517 |
+
|
518 |
+
all_hidden_dfs.append(df_hidden)
|
519 |
+
|
520 |
+
df_hidden = pd.concat(all_hidden_dfs, ignore_index=True)
|
521 |
+
|
522 |
+
df_hidden.rename(
|
523 |
+
columns={
|
524 |
+
"Candidate score": "Summary Score",
|
525 |
+
},
|
526 |
+
inplace=True,
|
527 |
+
)
|
528 |
+
|
529 |
+
df_hidden = df_hidden.sort_values(by="Summary Score", ascending=False)
|
530 |
+
|
531 |
+
df_hidden.reset_index(drop=True, inplace=True)
|
532 |
+
|
533 |
+
df_hidden.to_csv(
|
534 |
+
config_data.Filenames_POTENTIAL_CANDIDATES, index=False
|
535 |
+
)
|
536 |
+
|
537 |
+
person_id = 0
|
538 |
+
|
539 |
+
person_metadata = create_person_metadata(
|
540 |
+
person_id, files, video_metadata
|
541 |
+
)
|
542 |
|
543 |
+
existing_tuple = (
|
544 |
+
gr.Row(visible=True),
|
545 |
+
gr.Column(visible=True),
|
546 |
+
dataframe(
|
547 |
+
headers=df_hidden.columns.tolist(),
|
548 |
+
values=df_hidden.values.tolist(),
|
549 |
+
visible=True,
|
550 |
+
),
|
551 |
+
files_create_ui(
|
552 |
+
config_data.Filenames_POTENTIAL_CANDIDATES,
|
553 |
+
"single",
|
554 |
+
[".csv"],
|
555 |
+
config_data.OtherMessages_EXPORT_PG,
|
556 |
+
True,
|
557 |
+
False,
|
558 |
+
True,
|
559 |
+
"csv-container",
|
560 |
+
),
|
561 |
+
gr.Accordion(visible=False),
|
562 |
+
gr.HTML(visible=False),
|
563 |
+
dataframe(visible=False),
|
564 |
+
gr.Column(visible=True),
|
565 |
+
video_create_ui(
|
566 |
+
value=files[person_id],
|
567 |
+
file_name=Path(files[person_id]).name,
|
568 |
+
label="Best Person ID - " + str(person_id + 1),
|
569 |
+
visible=True,
|
570 |
+
elem_classes="video-sorted-container",
|
571 |
+
),
|
572 |
+
html_message(config_data.InformationMessages_NOTI_IN_DEV, False, False),
|
573 |
+
)
|
574 |
|
575 |
+
return existing_tuple[:-1] + person_metadata + existing_tuple[-1:]
|
576 |
elif practical_subtasks.lower() == "professional skills":
|
577 |
df_professional_skills = read_csv_file(config_data.Links_PROFESSIONAL_SKILLS)
|
578 |
|
579 |
+
pt_scores_copy = pt_scores.iloc[:, 1:].copy()
|
580 |
+
|
581 |
+
preprocess_scores_df(pt_scores_copy, config_data.Dataframes_PT_SCORES[0][0])
|
582 |
+
|
583 |
b5._priority_skill_calculation(
|
584 |
+
df_files=pt_scores_copy,
|
585 |
correlation_coefficients=df_professional_skills,
|
586 |
threshold=threshold_professional_skills,
|
587 |
out=False,
|
|
|
589 |
|
590 |
df = apply_rounding_and_rename_columns(b5.df_files_priority_skill_)
|
591 |
|
592 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
593 |
+
professional_skills_list = (
|
594 |
+
config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS.copy()
|
595 |
+
)
|
596 |
|
597 |
+
professional_skills_list.remove(dropdown_professional_skills)
|
598 |
+
|
599 |
+
del_cols = []
|
600 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
601 |
+
professional_skills_list = []
|
602 |
+
del_cols = config_data.Settings_DROPDOWN_MBTI_DEL_COLS_WEBCAM
|
603 |
|
604 |
df_hidden = df.drop(
|
605 |
columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS
|
606 |
+ professional_skills_list
|
607 |
+
+ del_cols
|
608 |
)
|
609 |
|
610 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
611 |
+
df_hidden = df_hidden.sort_values(
|
612 |
+
by=[dropdown_professional_skills], ascending=False
|
613 |
+
)
|
614 |
+
df_hidden.reset_index(inplace=True)
|
615 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
616 |
+
df_hidden = df_hidden.melt(
|
617 |
+
var_name="Professional Skill", value_name="Summary Score"
|
618 |
+
)
|
619 |
+
df_hidden = df_hidden.sort_values(by=["Summary Score"], ascending=False)
|
620 |
+
df_hidden.reset_index(drop=True, inplace=True)
|
621 |
|
622 |
+
df_hidden.to_csv(config_data.Filenames_PT_SKILLS_SCORES)
|
|
|
|
|
623 |
|
624 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
625 |
+
person_id = (
|
626 |
+
int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
627 |
+
)
|
628 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
629 |
+
person_id = 0
|
630 |
|
631 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
632 |
|
|
|
666 |
elif (
|
667 |
practical_subtasks.lower() == "finding a suitable junior colleague"
|
668 |
or practical_subtasks.lower() == "finding a suitable senior colleague"
|
669 |
+
or practical_subtasks.lower()
|
670 |
+
== "finding a suitable colleague by personality types"
|
671 |
):
|
672 |
+
pt_scores_copy = pt_scores.iloc[:, 1:].copy()
|
|
|
|
|
673 |
|
674 |
+
preprocess_scores_df(pt_scores_copy, config_data.Dataframes_PT_SCORES[0][0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
|
676 |
+
if (
|
677 |
+
practical_subtasks.lower()
|
678 |
+
!= "finding a suitable colleague by personality types"
|
679 |
+
):
|
680 |
+
df_correlation_coefficients = read_csv_file(
|
681 |
+
config_data.Links_FINDING_COLLEAGUE, ["ID"]
|
682 |
+
)
|
683 |
+
|
684 |
+
b5._colleague_ranking(
|
685 |
+
df_files=pt_scores_copy,
|
686 |
+
correlation_coefficients=df_correlation_coefficients,
|
687 |
+
target_scores=[
|
688 |
+
target_score_ope,
|
689 |
+
target_score_con,
|
690 |
+
target_score_ext,
|
691 |
+
target_score_agr,
|
692 |
+
target_score_nneu,
|
693 |
+
],
|
694 |
+
colleague=colleague_type(practical_subtasks),
|
695 |
+
equal_coefficients=equal_coefficient,
|
696 |
+
out=False,
|
697 |
+
)
|
698 |
+
df = apply_rounding_and_rename_columns(b5.df_files_colleague_)
|
699 |
|
700 |
+
df_hidden = df.drop(columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS)
|
701 |
|
702 |
+
df_hidden.to_csv(
|
703 |
+
colleague_type(practical_subtasks)
|
704 |
+
+ config_data.Filenames_COLLEAGUE_RANKING
|
705 |
+
)
|
706 |
+
else:
|
707 |
+
b5._colleague_personality_type_match(
|
708 |
+
df_files=pt_scores_copy,
|
709 |
+
correlation_coefficients=None,
|
710 |
+
target_scores=[
|
711 |
+
target_score_ope,
|
712 |
+
target_score_con,
|
713 |
+
target_score_ext,
|
714 |
+
target_score_agr,
|
715 |
+
target_score_nneu,
|
716 |
+
],
|
717 |
+
threshold=equal_coefficient,
|
718 |
+
out=False,
|
719 |
+
)
|
720 |
+
df = b5.df_files_MBTI_colleague_match_.rename(
|
721 |
+
columns={
|
722 |
+
"MBTI": "Personality Type",
|
723 |
+
"MBTI_Score": "Personality Type Score",
|
724 |
+
}
|
725 |
+
)
|
726 |
+
|
727 |
+
df_hidden = df[["Path", "Personality Type", "Match"]]
|
728 |
+
|
729 |
+
df_hidden.to_csv(config_data.Filenames_COLLEAGUE_RANKING)
|
730 |
|
731 |
df_hidden.reset_index(inplace=True)
|
732 |
|
733 |
+
person_id = (
|
734 |
+
int(
|
735 |
+
df_hidden.iloc[
|
736 |
+
(
|
737 |
+
0
|
738 |
+
if practical_subtasks.lower()
|
739 |
+
!= "finding a suitable colleague by personality types"
|
740 |
+
else 1
|
741 |
+
)
|
742 |
+
][config_data.Dataframes_PT_SCORES[0][0]]
|
743 |
+
)
|
744 |
+
- 1
|
745 |
+
)
|
746 |
|
747 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
748 |
|
|
|
783 |
elif (
|
784 |
practical_subtasks.lower() == "car characteristics"
|
785 |
or practical_subtasks.lower() == "mobile device application categories"
|
786 |
+
or practical_subtasks.lower() == "clothing styles"
|
787 |
):
|
788 |
if practical_subtasks.lower() == "car characteristics":
|
789 |
df_correlation_coefficients = read_csv_file(
|
|
|
794 |
df_correlation_coefficients = read_csv_file(
|
795 |
config_data.Links_MDA_CATEGORIES
|
796 |
)
|
797 |
+
elif practical_subtasks.lower() == "clothing styles":
|
798 |
df_correlation_coefficients = read_csv_file(config_data.Links_CLOTHING_SC)
|
799 |
|
800 |
+
if type_modes == config_data.Settings_TYPE_MODES[1]:
|
801 |
+
number_priority = df_correlation_coefficients.columns.size - 1
|
802 |
+
number_importance_traits = 5
|
803 |
+
|
804 |
pt_scores_copy = pt_scores.iloc[:, 1:].copy()
|
805 |
|
806 |
preprocess_scores_df(pt_scores_copy, config_data.Dataframes_PT_SCORES[0][0])
|
|
|
822 |
|
823 |
preprocess_scores_df(df, config_data.Dataframes_PT_SCORES[0][0])
|
824 |
|
825 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
826 |
+
del_cols = []
|
827 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
828 |
+
del_cols = config_data.Settings_DROPDOWN_MBTI_DEL_COLS_WEBCAM
|
829 |
+
|
830 |
+
df_hidden = df.drop(
|
831 |
+
columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS + del_cols
|
832 |
+
)
|
833 |
+
|
834 |
+
if type_modes == config_data.Settings_TYPE_MODES[1]:
|
835 |
+
df_hidden = df_hidden.T
|
836 |
+
|
837 |
+
df_hidden = df_hidden.head(-number_importance_traits)
|
838 |
+
|
839 |
+
df_hidden = df_hidden.reset_index()
|
840 |
+
|
841 |
+
df_hidden.columns = ["Priority", "Category"]
|
842 |
|
843 |
df_hidden.to_csv(consumer_preferences(practical_subtasks))
|
844 |
|
845 |
+
df_hidden.reset_index(
|
846 |
+
drop=True if type_modes == config_data.Settings_TYPE_MODES[1] else False,
|
847 |
+
inplace=True,
|
848 |
+
)
|
849 |
|
850 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
851 |
+
person_id = (
|
852 |
+
int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
853 |
+
)
|
854 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
855 |
+
person_id = 0
|
856 |
|
857 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
858 |
|
app/event_handlers/calculate_pt_scores_blocks.py
CHANGED
@@ -26,23 +26,52 @@ from app.components import (
|
|
26 |
)
|
27 |
|
28 |
|
29 |
-
def event_handler_calculate_pt_scores_blocks(
|
|
|
|
|
30 |
_ = evt_data.target.__class__.__name__
|
31 |
|
32 |
lang_id, _ = get_language_settings(language)
|
33 |
|
34 |
out = False
|
35 |
-
b5.get_avt_predictions_gradio(
|
36 |
-
paths=files, url_accuracy="", accuracy=False, lang="en", out=out
|
37 |
-
)
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
return (
|
45 |
-
html_message(
|
|
|
|
|
|
|
|
|
46 |
dataframe(visible=False),
|
47 |
files_create_ui(
|
48 |
None,
|
@@ -59,23 +88,24 @@ def event_handler_calculate_pt_scores_blocks(language, files, evt_data: gr.Event
|
|
59 |
radio_create_ui(
|
60 |
first_practical_task,
|
61 |
config_data.Labels_PRACTICAL_TASKS_LABEL,
|
62 |
-
list(map(str,
|
63 |
-
config_data.InformationMessages_PRACTICAL_TASKS_INFO,
|
64 |
True,
|
65 |
True,
|
66 |
),
|
67 |
radio_create_ui(
|
68 |
-
|
69 |
-
config_data.Labels_PRACTICAL_SUBTASKS_LABEL,
|
70 |
-
|
71 |
-
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO,
|
72 |
True,
|
73 |
True,
|
74 |
),
|
75 |
gr.JSON(
|
76 |
value={
|
77 |
-
str(task):
|
78 |
-
for
|
|
|
79 |
},
|
80 |
visible=False,
|
81 |
render=True,
|
@@ -149,9 +179,25 @@ def event_handler_calculate_pt_scores_blocks(language, files, evt_data: gr.Event
|
|
149 |
df_files = b5.df_files_.copy()
|
150 |
df_files.reset_index(inplace=True)
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
return (
|
153 |
html_message(
|
154 |
-
config_data.InformationMessages_NOTI_VIDEOS[lang_id],
|
|
|
|
|
|
|
155 |
),
|
156 |
dataframe(
|
157 |
headers=(config_data.Dataframes_PT_SCORES[lang_id]),
|
@@ -172,35 +218,38 @@ def event_handler_calculate_pt_scores_blocks(language, files, evt_data: gr.Event
|
|
172 |
gr.Column(visible=True),
|
173 |
radio_create_ui(
|
174 |
first_practical_task,
|
175 |
-
|
176 |
-
|
177 |
-
config_data.InformationMessages_PRACTICAL_TASKS_INFO,
|
178 |
True,
|
179 |
True,
|
180 |
),
|
181 |
radio_create_ui(
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO,
|
186 |
True,
|
187 |
True,
|
188 |
),
|
189 |
gr.JSON(
|
190 |
value={
|
191 |
-
str(task):
|
192 |
-
for
|
|
|
193 |
},
|
194 |
visible=False,
|
195 |
render=True,
|
196 |
),
|
197 |
-
gr.Column(
|
|
|
|
|
198 |
dropdown_create_ui(
|
199 |
label=f"Potential candidates by Personality Type of MBTI ({len(config_data.Settings_DROPDOWN_MBTI)})",
|
200 |
info=config_data.InformationMessages_DROPDOWN_MBTI_INFO,
|
201 |
choices=config_data.Settings_DROPDOWN_MBTI,
|
202 |
value=config_data.Settings_DROPDOWN_MBTI[0],
|
203 |
-
visible=True,
|
204 |
elem_classes="dropdown-container",
|
205 |
),
|
206 |
number_create_ui(
|
@@ -212,7 +261,7 @@ def event_handler_calculate_pt_scores_blocks(language, files, evt_data: gr.Event
|
|
212 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
213 |
show_label=True,
|
214 |
interactive=True,
|
215 |
-
visible=True,
|
216 |
render=True,
|
217 |
elem_classes="number-container",
|
218 |
),
|
|
|
26 |
)
|
27 |
|
28 |
|
29 |
+
def event_handler_calculate_pt_scores_blocks(
|
30 |
+
language, type_modes, files, video, evt_data: gr.EventData
|
31 |
+
):
|
32 |
_ = evt_data.target.__class__.__name__
|
33 |
|
34 |
lang_id, _ = get_language_settings(language)
|
35 |
|
36 |
out = False
|
|
|
|
|
|
|
37 |
|
38 |
+
try:
|
39 |
+
b5.get_avt_predictions_gradio(
|
40 |
+
paths=(
|
41 |
+
files if type_modes == config_data.Settings_TYPE_MODES[0] else [video]
|
42 |
+
),
|
43 |
+
url_accuracy="",
|
44 |
+
accuracy=False,
|
45 |
+
lang="en",
|
46 |
+
out=out,
|
47 |
+
)
|
48 |
+
except TypeError:
|
49 |
+
out = True
|
50 |
+
|
51 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
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 |
|
59 |
+
supported_practical_tasks_ren = [
|
60 |
+
{rename_map.get(k, k): v for k, v in d.items()}
|
61 |
+
for d in supported_practical_tasks
|
62 |
+
]
|
63 |
+
|
64 |
+
first_practical_task = next(iter(supported_practical_tasks_ren[lang_id]))
|
65 |
+
|
66 |
+
if out or len(b5.df_files_) == 0:
|
67 |
+
gr.Warning(config_data.OtherMessages_CALCULATE_PT_SCORES_ERR[lang_id])
|
68 |
|
69 |
return (
|
70 |
+
html_message(
|
71 |
+
config_data.OtherMessages_CALCULATE_PT_SCORES_ERR[lang_id],
|
72 |
+
False,
|
73 |
+
"notifications",
|
74 |
+
),
|
75 |
dataframe(visible=False),
|
76 |
files_create_ui(
|
77 |
None,
|
|
|
88 |
radio_create_ui(
|
89 |
first_practical_task,
|
90 |
config_data.Labels_PRACTICAL_TASKS_LABEL,
|
91 |
+
list(map(str, supported_practical_tasks_ren[lang_id].keys())),
|
92 |
+
config_data.InformationMessages_PRACTICAL_TASKS_INFO[lang_id],
|
93 |
True,
|
94 |
True,
|
95 |
),
|
96 |
radio_create_ui(
|
97 |
+
supported_practical_tasks_ren[lang_id][first_practical_task][0],
|
98 |
+
config_data.Labels_PRACTICAL_SUBTASKS_LABEL[lang_id],
|
99 |
+
supported_practical_tasks_ren[lang_id][first_practical_task],
|
100 |
+
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO[lang_id],
|
101 |
True,
|
102 |
True,
|
103 |
),
|
104 |
gr.JSON(
|
105 |
value={
|
106 |
+
str(task): supported_practical_tasks_ren[index].get(task, [None])[0]
|
107 |
+
for index in range(len(supported_practical_tasks_ren))
|
108 |
+
for task in supported_practical_tasks_ren[index].keys()
|
109 |
},
|
110 |
visible=False,
|
111 |
render=True,
|
|
|
179 |
df_files = b5.df_files_.copy()
|
180 |
df_files.reset_index(inplace=True)
|
181 |
|
182 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
183 |
+
practical_tasks_choices = list(
|
184 |
+
map(str, supported_practical_tasks_ren[lang_id].keys())
|
185 |
+
)
|
186 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
187 |
+
practical_tasks_choices = [
|
188 |
+
value
|
189 |
+
for i, value in enumerate(
|
190 |
+
map(str, supported_practical_tasks_ren[lang_id].keys())
|
191 |
+
)
|
192 |
+
if i not in {1}
|
193 |
+
]
|
194 |
+
|
195 |
return (
|
196 |
html_message(
|
197 |
+
config_data.InformationMessages_NOTI_VIDEOS[lang_id],
|
198 |
+
False,
|
199 |
+
False,
|
200 |
+
"notifications",
|
201 |
),
|
202 |
dataframe(
|
203 |
headers=(config_data.Dataframes_PT_SCORES[lang_id]),
|
|
|
218 |
gr.Column(visible=True),
|
219 |
radio_create_ui(
|
220 |
first_practical_task,
|
221 |
+
config_data.Labels_PRACTICAL_TASKS_LABEL[lang_id],
|
222 |
+
practical_tasks_choices,
|
223 |
+
config_data.InformationMessages_PRACTICAL_TASKS_INFO[lang_id],
|
224 |
True,
|
225 |
True,
|
226 |
),
|
227 |
radio_create_ui(
|
228 |
+
supported_practical_tasks_ren[lang_id][first_practical_task][0],
|
229 |
+
config_data.Labels_PRACTICAL_SUBTASKS_LABEL[lang_id],
|
230 |
+
supported_practical_tasks_ren[lang_id][first_practical_task],
|
231 |
+
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO[lang_id],
|
232 |
True,
|
233 |
True,
|
234 |
),
|
235 |
gr.JSON(
|
236 |
value={
|
237 |
+
str(task): supported_practical_tasks_ren[index].get(task, [None])[0]
|
238 |
+
for index in range(len(supported_practical_tasks_ren))
|
239 |
+
for task in supported_practical_tasks_ren[index].keys()
|
240 |
},
|
241 |
visible=False,
|
242 |
render=True,
|
243 |
),
|
244 |
+
gr.Column(
|
245 |
+
visible=True if type_modes == config_data.Settings_TYPE_MODES[0] else False
|
246 |
+
),
|
247 |
dropdown_create_ui(
|
248 |
label=f"Potential candidates by Personality Type of MBTI ({len(config_data.Settings_DROPDOWN_MBTI)})",
|
249 |
info=config_data.InformationMessages_DROPDOWN_MBTI_INFO,
|
250 |
choices=config_data.Settings_DROPDOWN_MBTI,
|
251 |
value=config_data.Settings_DROPDOWN_MBTI[0],
|
252 |
+
visible=True if type_modes == config_data.Settings_TYPE_MODES[0] else False,
|
253 |
elem_classes="dropdown-container",
|
254 |
),
|
255 |
number_create_ui(
|
|
|
261 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
262 |
show_label=True,
|
263 |
interactive=True,
|
264 |
+
visible=True if type_modes == config_data.Settings_TYPE_MODES[0] else False,
|
265 |
render=True,
|
266 |
elem_classes="number-container",
|
267 |
),
|
app/event_handlers/clear_blocks.py
CHANGED
@@ -25,20 +25,47 @@ from app.components import (
|
|
25 |
from app.utils import get_language_settings
|
26 |
|
27 |
|
28 |
-
def event_handler_clear_blocks(language):
|
29 |
lang_id, _ = get_language_settings(language)
|
30 |
|
31 |
-
first_practical_task = next(iter(supported_practical_tasks))
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
label="{} ({})".format(
|
37 |
config_data.OtherMessages_VIDEO_FILES[lang_id],
|
38 |
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
39 |
),
|
40 |
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
),
|
|
|
|
|
42 |
video_create_ui(),
|
43 |
button(
|
44 |
config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
|
@@ -71,24 +98,25 @@ def event_handler_clear_blocks(language):
|
|
71 |
gr.Column(visible=False),
|
72 |
radio_create_ui(
|
73 |
first_practical_task,
|
74 |
-
|
75 |
-
list(map(str, supported_practical_tasks.keys())),
|
76 |
-
config_data.InformationMessages_PRACTICAL_TASKS_INFO,
|
77 |
True,
|
78 |
True,
|
79 |
),
|
80 |
radio_create_ui(
|
81 |
-
supported_practical_tasks[first_practical_task][0],
|
82 |
-
|
83 |
-
supported_practical_tasks[first_practical_task],
|
84 |
-
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO,
|
85 |
True,
|
86 |
True,
|
87 |
),
|
88 |
gr.JSON(
|
89 |
value={
|
90 |
-
str(task): supported_practical_tasks.get(task, [None])[0]
|
91 |
-
for
|
|
|
92 |
},
|
93 |
visible=False,
|
94 |
render=True,
|
|
|
25 |
from app.utils import get_language_settings
|
26 |
|
27 |
|
28 |
+
def event_handler_clear_blocks(language, type_modes):
|
29 |
lang_id, _ = get_language_settings(language)
|
30 |
|
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[
|
37 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
38 |
+
],
|
39 |
+
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
40 |
+
),
|
41 |
+
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
|
42 |
+
)
|
43 |
+
webcam = gr.Video(interactive=False, visible=False)
|
44 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
45 |
+
files_ui = files_create_ui(
|
46 |
label="{} ({})".format(
|
47 |
config_data.OtherMessages_VIDEO_FILES[lang_id],
|
48 |
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
49 |
),
|
50 |
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
|
51 |
+
interactive=False,
|
52 |
+
visible=False,
|
53 |
+
)
|
54 |
+
webcam = gr.Video(interactive=True, visible=True)
|
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",
|
66 |
),
|
67 |
+
files_ui,
|
68 |
+
webcam,
|
69 |
video_create_ui(),
|
70 |
button(
|
71 |
config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
|
|
|
98 |
gr.Column(visible=False),
|
99 |
radio_create_ui(
|
100 |
first_practical_task,
|
101 |
+
config_data.Labels_PRACTICAL_TASKS_LABEL[lang_id],
|
102 |
+
list(map(str, supported_practical_tasks[lang_id].keys())),
|
103 |
+
config_data.InformationMessages_PRACTICAL_TASKS_INFO[lang_id],
|
104 |
True,
|
105 |
True,
|
106 |
),
|
107 |
radio_create_ui(
|
108 |
+
supported_practical_tasks[lang_id][first_practical_task][0],
|
109 |
+
config_data.Labels_PRACTICAL_SUBTASKS_LABEL[lang_id],
|
110 |
+
supported_practical_tasks[lang_id][first_practical_task],
|
111 |
+
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO[lang_id],
|
112 |
True,
|
113 |
True,
|
114 |
),
|
115 |
gr.JSON(
|
116 |
value={
|
117 |
+
str(task): supported_practical_tasks[index].get(task, [None])[0]
|
118 |
+
for index in range(len(supported_practical_tasks))
|
119 |
+
for task in supported_practical_tasks[index].keys()
|
120 |
},
|
121 |
visible=False,
|
122 |
render=True,
|
app/event_handlers/dropdown_candidates.py
CHANGED
@@ -7,16 +7,13 @@ License: MIT License
|
|
7 |
|
8 |
# Importing necessary components for the Gradio app
|
9 |
from app.config import config_data
|
10 |
-
from app.utils import
|
11 |
-
from app.
|
|
|
12 |
|
13 |
|
14 |
def event_handler_dropdown_candidates(practical_subtasks, dropdown_candidates):
|
15 |
if practical_subtasks.lower() == "professional groups":
|
16 |
-
df_traits_priority_for_professions = read_csv_file(
|
17 |
-
config_data.Links_PROFESSIONS
|
18 |
-
)
|
19 |
-
|
20 |
weights, interactive = extract_profession_weights(
|
21 |
df_traits_priority_for_professions,
|
22 |
dropdown_candidates,
|
|
|
7 |
|
8 |
# Importing necessary components for the Gradio app
|
9 |
from app.config import config_data
|
10 |
+
from app.utils import extract_profession_weights
|
11 |
+
from app.data_init import df_traits_priority_for_professions
|
12 |
+
from app.components import number_create_ui
|
13 |
|
14 |
|
15 |
def event_handler_dropdown_candidates(practical_subtasks, dropdown_candidates):
|
16 |
if practical_subtasks.lower() == "professional groups":
|
|
|
|
|
|
|
|
|
17 |
weights, interactive = extract_profession_weights(
|
18 |
df_traits_priority_for_professions,
|
19 |
dropdown_candidates,
|
app/event_handlers/event_handlers.py
CHANGED
@@ -9,11 +9,13 @@ import gradio as gr
|
|
9 |
|
10 |
# Importing necessary components for the Gradio app
|
11 |
from app.event_handlers.languages import event_handler_languages
|
|
|
12 |
from app.event_handlers.files import (
|
13 |
event_handler_files,
|
14 |
event_handler_files_select,
|
15 |
event_handler_files_delete,
|
16 |
)
|
|
|
17 |
from app.event_handlers.examples_blocks import event_handler_examples_blocks
|
18 |
from app.event_handlers.clear_blocks import event_handler_clear_blocks
|
19 |
from app.event_handlers.calculate_pt_scores_blocks import (
|
@@ -33,6 +35,9 @@ def setup_app_event_handlers(
|
|
33 |
step_1,
|
34 |
notifications,
|
35 |
files,
|
|
|
|
|
|
|
36 |
video,
|
37 |
examples,
|
38 |
calculate_pt_scores,
|
@@ -101,7 +106,16 @@ def setup_app_event_handlers(
|
|
101 |
# Events
|
102 |
languages.select(
|
103 |
fn=event_handler_languages,
|
104 |
-
inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
outputs=[
|
106 |
description,
|
107 |
step_1,
|
@@ -112,6 +126,8 @@ def setup_app_event_handlers(
|
|
112 |
tab3,
|
113 |
tab4,
|
114 |
files,
|
|
|
|
|
115 |
video,
|
116 |
examples,
|
117 |
calculate_pt_scores,
|
@@ -120,6 +136,77 @@ def setup_app_event_handlers(
|
|
120 |
pt_scores,
|
121 |
csv_pt_scores,
|
122 |
step_2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
],
|
124 |
queue=True,
|
125 |
)
|
@@ -141,13 +228,17 @@ def setup_app_event_handlers(
|
|
141 |
[video],
|
142 |
queue=True,
|
143 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
gr.on(
|
145 |
triggers=[calculate_pt_scores.click],
|
146 |
fn=event_handler_calculate_pt_scores_blocks,
|
147 |
-
inputs=[
|
148 |
-
languages,
|
149 |
-
files,
|
150 |
-
],
|
151 |
outputs=[
|
152 |
notifications,
|
153 |
pt_scores,
|
@@ -208,18 +299,75 @@ def setup_app_event_handlers(
|
|
208 |
)
|
209 |
examples.click(
|
210 |
fn=event_handler_examples_blocks,
|
211 |
-
inputs=[],
|
212 |
outputs=[
|
|
|
213 |
files,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
],
|
215 |
queue=True,
|
216 |
)
|
217 |
clear_app.click(
|
218 |
fn=event_handler_clear_blocks,
|
219 |
-
inputs=[languages],
|
220 |
outputs=[
|
221 |
notifications,
|
222 |
files,
|
|
|
223 |
video,
|
224 |
calculate_pt_scores,
|
225 |
clear_app,
|
@@ -280,13 +428,19 @@ def setup_app_event_handlers(
|
|
280 |
)
|
281 |
practical_tasks.change(
|
282 |
event_handler_practical_tasks,
|
283 |
-
[practical_tasks, practical_subtasks_selected],
|
284 |
[practical_subtasks],
|
285 |
queue=True,
|
286 |
)
|
287 |
practical_subtasks.change(
|
288 |
event_handler_practical_subtasks,
|
289 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
[
|
291 |
practical_subtasks_selected,
|
292 |
settings_practical_tasks,
|
@@ -327,7 +481,10 @@ def setup_app_event_handlers(
|
|
327 |
calculate_practical_task.click(
|
328 |
fn=event_handler_calculate_practical_task_blocks,
|
329 |
inputs=[
|
|
|
|
|
330 |
files,
|
|
|
331 |
practical_subtasks,
|
332 |
pt_scores,
|
333 |
dropdown_mbti,
|
@@ -380,7 +537,7 @@ def setup_app_event_handlers(
|
|
380 |
)
|
381 |
practical_task_sorted.select(
|
382 |
event_handler_practical_task_sorted,
|
383 |
-
[files, practical_task_sorted],
|
384 |
[
|
385 |
video_sorted_column,
|
386 |
video_sorted,
|
|
|
9 |
|
10 |
# Importing necessary components for the Gradio app
|
11 |
from app.event_handlers.languages import event_handler_languages
|
12 |
+
from app.event_handlers.switching_modes import event_handler_switching_modes
|
13 |
from app.event_handlers.files import (
|
14 |
event_handler_files,
|
15 |
event_handler_files_select,
|
16 |
event_handler_files_delete,
|
17 |
)
|
18 |
+
from app.event_handlers.webcam import event_handler_webcam
|
19 |
from app.event_handlers.examples_blocks import event_handler_examples_blocks
|
20 |
from app.event_handlers.clear_blocks import event_handler_clear_blocks
|
21 |
from app.event_handlers.calculate_pt_scores_blocks import (
|
|
|
35 |
step_1,
|
36 |
notifications,
|
37 |
files,
|
38 |
+
webcam,
|
39 |
+
switching_modes,
|
40 |
+
type_modes,
|
41 |
video,
|
42 |
examples,
|
43 |
calculate_pt_scores,
|
|
|
106 |
# Events
|
107 |
languages.select(
|
108 |
fn=event_handler_languages,
|
109 |
+
inputs=[
|
110 |
+
languages,
|
111 |
+
files,
|
112 |
+
video,
|
113 |
+
type_modes,
|
114 |
+
pt_scores,
|
115 |
+
csv_pt_scores,
|
116 |
+
practical_tasks,
|
117 |
+
practical_subtasks,
|
118 |
+
],
|
119 |
outputs=[
|
120 |
description,
|
121 |
step_1,
|
|
|
126 |
tab3,
|
127 |
tab4,
|
128 |
files,
|
129 |
+
webcam,
|
130 |
+
switching_modes,
|
131 |
video,
|
132 |
examples,
|
133 |
calculate_pt_scores,
|
|
|
136 |
pt_scores,
|
137 |
csv_pt_scores,
|
138 |
step_2,
|
139 |
+
practical_tasks_column,
|
140 |
+
practical_tasks,
|
141 |
+
practical_subtasks,
|
142 |
+
],
|
143 |
+
queue=True,
|
144 |
+
)
|
145 |
+
switching_modes.click(
|
146 |
+
fn=event_handler_switching_modes,
|
147 |
+
inputs=[languages, type_modes],
|
148 |
+
outputs=[
|
149 |
+
notifications,
|
150 |
+
files,
|
151 |
+
webcam,
|
152 |
+
switching_modes,
|
153 |
+
type_modes,
|
154 |
+
video,
|
155 |
+
examples,
|
156 |
+
calculate_pt_scores,
|
157 |
+
clear_app,
|
158 |
+
pt_scores,
|
159 |
+
csv_pt_scores,
|
160 |
+
step_2,
|
161 |
+
practical_tasks_column,
|
162 |
+
practical_tasks,
|
163 |
+
practical_subtasks,
|
164 |
+
practical_subtasks_selected,
|
165 |
+
settings_practical_tasks,
|
166 |
+
dropdown_mbti,
|
167 |
+
threshold_mbti,
|
168 |
+
threshold_professional_skills,
|
169 |
+
dropdown_professional_skills,
|
170 |
+
target_score_ope,
|
171 |
+
target_score_con,
|
172 |
+
target_score_ext,
|
173 |
+
target_score_agr,
|
174 |
+
target_score_nneu,
|
175 |
+
equal_coefficient,
|
176 |
+
number_priority,
|
177 |
+
number_importance_traits,
|
178 |
+
threshold_consumer_preferences,
|
179 |
+
dropdown_candidates,
|
180 |
+
number_openness,
|
181 |
+
number_conscientiousness,
|
182 |
+
number_extraversion,
|
183 |
+
number_agreeableness,
|
184 |
+
number_non_neuroticism,
|
185 |
+
sorted_videos,
|
186 |
+
sorted_videos_column,
|
187 |
+
practical_task_sorted,
|
188 |
+
csv_practical_task_sorted,
|
189 |
+
mbti_accordion,
|
190 |
+
mbti_description,
|
191 |
+
mbti_description_data,
|
192 |
+
video_sorted_column,
|
193 |
+
video_sorted,
|
194 |
+
metadata,
|
195 |
+
metadata_1,
|
196 |
+
name_row,
|
197 |
+
name_logo,
|
198 |
+
name,
|
199 |
+
surname_row,
|
200 |
+
surname_logo,
|
201 |
+
surname,
|
202 |
+
metadata_2,
|
203 |
+
email_row,
|
204 |
+
email_logo,
|
205 |
+
email,
|
206 |
+
phone_row,
|
207 |
+
phone_logo,
|
208 |
+
phone,
|
209 |
+
in_development,
|
210 |
],
|
211 |
queue=True,
|
212 |
)
|
|
|
228 |
[video],
|
229 |
queue=True,
|
230 |
)
|
231 |
+
gr.on(
|
232 |
+
triggers=[webcam.upload, webcam.stop_recording],
|
233 |
+
fn=event_handler_webcam,
|
234 |
+
inputs=[languages, webcam, pt_scores],
|
235 |
+
outputs=[notifications, video, webcam, calculate_pt_scores, clear_app],
|
236 |
+
queue=True,
|
237 |
+
)
|
238 |
gr.on(
|
239 |
triggers=[calculate_pt_scores.click],
|
240 |
fn=event_handler_calculate_pt_scores_blocks,
|
241 |
+
inputs=[languages, type_modes, files, video],
|
|
|
|
|
|
|
242 |
outputs=[
|
243 |
notifications,
|
244 |
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,
|
309 |
+
pt_scores,
|
310 |
+
csv_pt_scores,
|
311 |
+
step_2,
|
312 |
+
practical_tasks_column,
|
313 |
+
practical_tasks,
|
314 |
+
practical_subtasks,
|
315 |
+
practical_subtasks_selected,
|
316 |
+
settings_practical_tasks,
|
317 |
+
dropdown_mbti,
|
318 |
+
threshold_mbti,
|
319 |
+
threshold_professional_skills,
|
320 |
+
dropdown_professional_skills,
|
321 |
+
target_score_ope,
|
322 |
+
target_score_con,
|
323 |
+
target_score_ext,
|
324 |
+
target_score_agr,
|
325 |
+
target_score_nneu,
|
326 |
+
equal_coefficient,
|
327 |
+
number_priority,
|
328 |
+
number_importance_traits,
|
329 |
+
threshold_consumer_preferences,
|
330 |
+
dropdown_candidates,
|
331 |
+
number_openness,
|
332 |
+
number_conscientiousness,
|
333 |
+
number_extraversion,
|
334 |
+
number_agreeableness,
|
335 |
+
number_non_neuroticism,
|
336 |
+
sorted_videos,
|
337 |
+
sorted_videos_column,
|
338 |
+
practical_task_sorted,
|
339 |
+
csv_practical_task_sorted,
|
340 |
+
mbti_accordion,
|
341 |
+
mbti_description,
|
342 |
+
mbti_description_data,
|
343 |
+
video_sorted_column,
|
344 |
+
video_sorted,
|
345 |
+
metadata,
|
346 |
+
metadata_1,
|
347 |
+
name_row,
|
348 |
+
name_logo,
|
349 |
+
name,
|
350 |
+
surname_row,
|
351 |
+
surname_logo,
|
352 |
+
surname,
|
353 |
+
metadata_2,
|
354 |
+
email_row,
|
355 |
+
email_logo,
|
356 |
+
email,
|
357 |
+
phone_row,
|
358 |
+
phone_logo,
|
359 |
+
phone,
|
360 |
+
in_development,
|
361 |
],
|
362 |
queue=True,
|
363 |
)
|
364 |
clear_app.click(
|
365 |
fn=event_handler_clear_blocks,
|
366 |
+
inputs=[languages, type_modes],
|
367 |
outputs=[
|
368 |
notifications,
|
369 |
files,
|
370 |
+
webcam,
|
371 |
video,
|
372 |
calculate_pt_scores,
|
373 |
clear_app,
|
|
|
428 |
)
|
429 |
practical_tasks.change(
|
430 |
event_handler_practical_tasks,
|
431 |
+
[languages, type_modes, practical_tasks, practical_subtasks_selected],
|
432 |
[practical_subtasks],
|
433 |
queue=True,
|
434 |
)
|
435 |
practical_subtasks.change(
|
436 |
event_handler_practical_subtasks,
|
437 |
+
[
|
438 |
+
languages,
|
439 |
+
type_modes,
|
440 |
+
practical_tasks,
|
441 |
+
practical_subtasks,
|
442 |
+
practical_subtasks_selected,
|
443 |
+
],
|
444 |
[
|
445 |
practical_subtasks_selected,
|
446 |
settings_practical_tasks,
|
|
|
481 |
calculate_practical_task.click(
|
482 |
fn=event_handler_calculate_practical_task_blocks,
|
483 |
inputs=[
|
484 |
+
languages,
|
485 |
+
type_modes,
|
486 |
files,
|
487 |
+
video,
|
488 |
practical_subtasks,
|
489 |
pt_scores,
|
490 |
dropdown_mbti,
|
|
|
537 |
)
|
538 |
practical_task_sorted.select(
|
539 |
event_handler_practical_task_sorted,
|
540 |
+
[type_modes, files, video, practical_task_sorted],
|
541 |
[
|
542 |
video_sorted_column,
|
543 |
video_sorted,
|
app/event_handlers/examples_blocks.py
CHANGED
@@ -6,25 +6,177 @@ License: MIT License
|
|
6 |
"""
|
7 |
|
8 |
import re
|
|
|
9 |
from pathlib import Path
|
10 |
|
11 |
# Importing necessary components for the Gradio app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
# import hashlib
|
14 |
-
# import time
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
# time_bytes = str(current_time).encode("utf-8")
|
19 |
-
# hash_object = hashlib.sha256(time_bytes)
|
20 |
-
# hex_digest = hash_object.hexdigest()
|
21 |
-
# print(hex_digest[:15])
|
22 |
|
|
|
23 |
|
24 |
-
def event_handler_examples_blocks():
|
25 |
videos_dir = Path("videos")
|
26 |
video_files = sorted(
|
27 |
(str(p) for p in videos_dir.glob("*.mp4")),
|
28 |
key=lambda x: int(re.search(r"\d+", Path(x).stem).group()),
|
29 |
)
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
"""
|
7 |
|
8 |
import re
|
9 |
+
import gradio as gr
|
10 |
from pathlib import Path
|
11 |
|
12 |
# Importing necessary components for the Gradio app
|
13 |
+
from app.config import config_data
|
14 |
+
from app.description_steps import STEP_2
|
15 |
+
from app.practical_tasks import supported_practical_tasks
|
16 |
+
from app.components import (
|
17 |
+
html_message,
|
18 |
+
files_create_ui,
|
19 |
+
video_create_ui,
|
20 |
+
button,
|
21 |
+
dataframe,
|
22 |
+
radio_create_ui,
|
23 |
+
number_create_ui,
|
24 |
+
dropdown_create_ui,
|
25 |
+
textbox_create_ui,
|
26 |
+
)
|
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]))
|
34 |
|
|
|
35 |
videos_dir = Path("videos")
|
36 |
video_files = sorted(
|
37 |
(str(p) for p in videos_dir.glob("*.mp4")),
|
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],
|
72 |
+
file_name=Path(Path(video_files[0]).name).name,
|
73 |
+
),
|
74 |
+
button(
|
75 |
+
config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
|
76 |
+
True,
|
77 |
+
3,
|
78 |
+
"./images/calculate_pt_scores.ico",
|
79 |
+
True,
|
80 |
+
"calculate_oceanai",
|
81 |
+
),
|
82 |
+
button(
|
83 |
+
config_data.OtherMessages_CLEAR_APP[lang_id],
|
84 |
+
True,
|
85 |
+
1,
|
86 |
+
"./images/clear.ico",
|
87 |
+
True,
|
88 |
+
"clear_oceanai",
|
89 |
+
),
|
90 |
+
dataframe(visible=False),
|
91 |
+
files_create_ui(
|
92 |
+
None,
|
93 |
+
"single",
|
94 |
+
[".csv"],
|
95 |
+
config_data.OtherMessages_EXPORT_PT_SCORES[lang_id],
|
96 |
+
True,
|
97 |
+
False,
|
98 |
+
False,
|
99 |
+
"csv-container",
|
100 |
+
),
|
101 |
+
gr.HTML(value=STEP_2[lang_id], visible=False),
|
102 |
+
gr.Column(visible=False),
|
103 |
+
radio_create_ui(
|
104 |
+
first_practical_task,
|
105 |
+
config_data.Labels_PRACTICAL_TASKS_LABEL[lang_id],
|
106 |
+
list(map(str, supported_practical_tasks[lang_id].keys())),
|
107 |
+
config_data.InformationMessages_PRACTICAL_TASKS_INFO[lang_id],
|
108 |
+
True,
|
109 |
+
True,
|
110 |
+
),
|
111 |
+
radio_create_ui(
|
112 |
+
supported_practical_tasks[lang_id][first_practical_task][0],
|
113 |
+
config_data.Labels_PRACTICAL_SUBTASKS_LABEL[lang_id],
|
114 |
+
supported_practical_tasks[lang_id][first_practical_task],
|
115 |
+
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO[lang_id],
|
116 |
+
True,
|
117 |
+
True,
|
118 |
+
),
|
119 |
+
gr.JSON(
|
120 |
+
value={
|
121 |
+
str(task): supported_practical_tasks[index].get(task, [None])[0]
|
122 |
+
for index in range(len(supported_practical_tasks))
|
123 |
+
for task in supported_practical_tasks[index].keys()
|
124 |
+
},
|
125 |
+
visible=False,
|
126 |
+
render=True,
|
127 |
+
),
|
128 |
+
gr.Column(visible=False),
|
129 |
+
dropdown_create_ui(visible=False),
|
130 |
+
number_create_ui(visible=False),
|
131 |
+
number_create_ui(visible=False),
|
132 |
+
dropdown_create_ui(visible=False),
|
133 |
+
number_create_ui(visible=False),
|
134 |
+
number_create_ui(visible=False),
|
135 |
+
number_create_ui(visible=False),
|
136 |
+
number_create_ui(visible=False),
|
137 |
+
number_create_ui(visible=False),
|
138 |
+
number_create_ui(visible=False),
|
139 |
+
number_create_ui(visible=False),
|
140 |
+
number_create_ui(visible=False),
|
141 |
+
number_create_ui(visible=False),
|
142 |
+
dropdown_create_ui(visible=False),
|
143 |
+
number_create_ui(visible=False),
|
144 |
+
number_create_ui(visible=False),
|
145 |
+
number_create_ui(visible=False),
|
146 |
+
number_create_ui(visible=False),
|
147 |
+
number_create_ui(visible=False),
|
148 |
+
gr.Row(visible=False),
|
149 |
+
gr.Column(visible=False),
|
150 |
+
dataframe(visible=False),
|
151 |
+
files_create_ui(
|
152 |
+
None,
|
153 |
+
"single",
|
154 |
+
[".csv"],
|
155 |
+
config_data.OtherMessages_EXPORT_PS,
|
156 |
+
True,
|
157 |
+
False,
|
158 |
+
False,
|
159 |
+
"csv-container",
|
160 |
+
),
|
161 |
+
gr.Accordion(visible=False),
|
162 |
+
gr.HTML(visible=False),
|
163 |
+
dataframe(visible=False),
|
164 |
+
gr.Column(visible=False),
|
165 |
+
video_create_ui(visible=False),
|
166 |
+
gr.Column(visible=False),
|
167 |
+
gr.Row(visible=False),
|
168 |
+
gr.Row(visible=False),
|
169 |
+
gr.Image(visible=False),
|
170 |
+
textbox_create_ui(visible=False),
|
171 |
+
gr.Row(visible=False),
|
172 |
+
gr.Image(visible=False),
|
173 |
+
textbox_create_ui(visible=False),
|
174 |
+
gr.Row(visible=False),
|
175 |
+
gr.Row(visible=False),
|
176 |
+
gr.Image(visible=False),
|
177 |
+
textbox_create_ui(visible=False),
|
178 |
+
gr.Row(visible=False),
|
179 |
+
gr.Image(visible=False),
|
180 |
+
textbox_create_ui(visible=False),
|
181 |
+
html_message(config_data.InformationMessages_NOTI_IN_DEV, False, False),
|
182 |
+
)
|
app/event_handlers/files.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
"""
|
2 |
-
File:
|
3 |
Author: Elena Ryumina and Dmitry Ryumin
|
4 |
-
Description: Event handler for
|
5 |
License: MIT License
|
6 |
"""
|
7 |
|
@@ -19,7 +19,16 @@ def event_handler_files(language, files, video, pt_scores):
|
|
19 |
|
20 |
if not files:
|
21 |
return (
|
22 |
-
html_message(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
video_create_ui(label=config_data.OtherMessages_VIDEO_PLAYER[lang_id]),
|
24 |
button(
|
25 |
config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
|
@@ -47,6 +56,7 @@ def event_handler_files(language, files, video, pt_scores):
|
|
47 |
config_data.OtherMessages_NOTI_CALCULATE[lang_id],
|
48 |
True,
|
49 |
False if pt_scores.shape[1] >= 7 else True,
|
|
|
50 |
),
|
51 |
video_create_ui(
|
52 |
value=video,
|
|
|
1 |
"""
|
2 |
+
File: files.py
|
3 |
Author: Elena Ryumina and Dmitry Ryumin
|
4 |
+
Description: Event handler for files.
|
5 |
License: MIT License
|
6 |
"""
|
7 |
|
|
|
19 |
|
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",
|
31 |
+
),
|
32 |
video_create_ui(label=config_data.OtherMessages_VIDEO_PLAYER[lang_id]),
|
33 |
button(
|
34 |
config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
|
|
|
56 |
config_data.OtherMessages_NOTI_CALCULATE[lang_id],
|
57 |
True,
|
58 |
False if pt_scores.shape[1] >= 7 else True,
|
59 |
+
"notifications",
|
60 |
),
|
61 |
video_create_ui(
|
62 |
value=video,
|
app/event_handlers/languages.py
CHANGED
@@ -19,17 +19,91 @@ from app.components import (
|
|
19 |
button,
|
20 |
html_message,
|
21 |
dataframe,
|
|
|
22 |
)
|
23 |
from app.utils import get_language_settings
|
|
|
24 |
|
25 |
|
26 |
-
def event_handler_languages(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
lang_id, choices = get_language_settings(languages)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
if not video:
|
30 |
video = video_create_ui(label=config_data.OtherMessages_VIDEO_PLAYER[lang_id])
|
31 |
noti_videos = html_message(
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
)
|
34 |
else:
|
35 |
video = video_create_ui(
|
@@ -41,6 +115,7 @@ def event_handler_languages(languages, files, video, pt_scores, csv_pt_scores):
|
|
41 |
config_data.OtherMessages_NOTI_CALCULATE[lang_id],
|
42 |
True,
|
43 |
False if pt_scores.shape[1] >= 7 else True,
|
|
|
44 |
)
|
45 |
|
46 |
csv_pt_scores = files_create_ui(
|
@@ -57,6 +132,10 @@ def event_handler_languages(languages, files, video, pt_scores, csv_pt_scores):
|
|
57 |
value=STEP_2[lang_id], visible=True if pt_scores.shape[1] >= 7 else False
|
58 |
)
|
59 |
|
|
|
|
|
|
|
|
|
60 |
if pt_scores.shape[1] >= 7:
|
61 |
pt_scores = dataframe(
|
62 |
headers=(config_data.Dataframes_PT_SCORES[lang_id]),
|
@@ -66,6 +145,22 @@ def event_handler_languages(languages, files, video, pt_scores, csv_pt_scores):
|
|
66 |
else:
|
67 |
pt_scores = dataframe(visible=False)
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
return (
|
70 |
gr.Markdown(value=DESCRIPTIONS[lang_id]),
|
71 |
gr.HTML(value=STEP_1[lang_id]),
|
@@ -85,23 +180,11 @@ def event_handler_languages(languages, files, video, pt_scores, csv_pt_scores):
|
|
85 |
gr.Tab(config_data.Labels_ABOUT_APP_LABEL[lang_id]),
|
86 |
gr.Tab(config_data.Labels_ABOUT_AUTHORS_LABEL[lang_id]),
|
87 |
gr.Tab(config_data.Labels_REQUIREMENTS_LABEL[lang_id]),
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
config_data.OtherMessages_VIDEO_FILES[lang_id],
|
92 |
-
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
93 |
-
),
|
94 |
-
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
|
95 |
-
),
|
96 |
video,
|
97 |
-
|
98 |
-
config_data.OtherMessages_EXAMPLES_APP[lang_id],
|
99 |
-
True,
|
100 |
-
1,
|
101 |
-
"./images/examples.ico",
|
102 |
-
True,
|
103 |
-
"examples_oceanai",
|
104 |
-
),
|
105 |
button(
|
106 |
config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
|
107 |
True if files else False,
|
@@ -122,4 +205,21 @@ def event_handler_languages(languages, files, video, pt_scores, csv_pt_scores):
|
|
122 |
pt_scores,
|
123 |
csv_pt_scores,
|
124 |
step_2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
)
|
|
|
19 |
button,
|
20 |
html_message,
|
21 |
dataframe,
|
22 |
+
radio_create_ui,
|
23 |
)
|
24 |
from app.utils import get_language_settings
|
25 |
+
from app.practical_tasks import supported_practical_tasks
|
26 |
|
27 |
|
28 |
+
def event_handler_languages(
|
29 |
+
languages,
|
30 |
+
files,
|
31 |
+
video,
|
32 |
+
type_modes,
|
33 |
+
pt_scores,
|
34 |
+
csv_pt_scores,
|
35 |
+
practical_tasks,
|
36 |
+
practical_subtasks,
|
37 |
+
):
|
38 |
lang_id, choices = get_language_settings(languages)
|
39 |
+
lang_id_inverse = {0: 1, 1: 0}.get(lang_id, None)
|
40 |
+
|
41 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
42 |
+
files_ui = files_create_ui(
|
43 |
+
label="{} ({})".format(
|
44 |
+
config_data.OtherMessages_VIDEO_FILES[
|
45 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
46 |
+
],
|
47 |
+
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
48 |
+
),
|
49 |
+
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
|
50 |
+
)
|
51 |
+
webcam = gr.Video(interactive=False, visible=False)
|
52 |
+
switching_modes = button(
|
53 |
+
config_data.OtherMessages_SWITCHEHG_MODES_ONLINE[lang_id],
|
54 |
+
True,
|
55 |
+
1,
|
56 |
+
"./images/webcam.ico",
|
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(
|
71 |
+
config_data.OtherMessages_VIDEO_FILES[lang_id],
|
72 |
+
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
73 |
+
),
|
74 |
+
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
|
75 |
+
interactive=False,
|
76 |
+
visible=False,
|
77 |
+
)
|
78 |
+
webcam = gr.Video(interactive=True, visible=True)
|
79 |
+
switching_modes = button(
|
80 |
+
config_data.OtherMessages_SWITCHEHG_MODES_OFFLINE[lang_id],
|
81 |
+
True,
|
82 |
+
1,
|
83 |
+
"./images/videos.ico",
|
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",
|
107 |
)
|
108 |
else:
|
109 |
video = video_create_ui(
|
|
|
115 |
config_data.OtherMessages_NOTI_CALCULATE[lang_id],
|
116 |
True,
|
117 |
False if pt_scores.shape[1] >= 7 else True,
|
118 |
+
"notifications",
|
119 |
)
|
120 |
|
121 |
csv_pt_scores = files_create_ui(
|
|
|
132 |
value=STEP_2[lang_id], visible=True if pt_scores.shape[1] >= 7 else False
|
133 |
)
|
134 |
|
135 |
+
practical_tasks_column = gr.Column(
|
136 |
+
visible=True if pt_scores.shape[1] >= 7 else False
|
137 |
+
)
|
138 |
+
|
139 |
if pt_scores.shape[1] >= 7:
|
140 |
pt_scores = dataframe(
|
141 |
headers=(config_data.Dataframes_PT_SCORES[lang_id]),
|
|
|
145 |
else:
|
146 |
pt_scores = dataframe(visible=False)
|
147 |
|
148 |
+
current_lang_tasks = list(map(str, supported_practical_tasks[lang_id].keys()))
|
149 |
+
inverse_lang_tasks = list(
|
150 |
+
map(str, supported_practical_tasks[lang_id_inverse].keys())
|
151 |
+
)
|
152 |
+
|
153 |
+
if practical_tasks in inverse_lang_tasks:
|
154 |
+
practical_task = current_lang_tasks[inverse_lang_tasks.index(practical_tasks)]
|
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]),
|
166 |
gr.HTML(value=STEP_1[lang_id]),
|
|
|
180 |
gr.Tab(config_data.Labels_ABOUT_APP_LABEL[lang_id]),
|
181 |
gr.Tab(config_data.Labels_ABOUT_AUTHORS_LABEL[lang_id]),
|
182 |
gr.Tab(config_data.Labels_REQUIREMENTS_LABEL[lang_id]),
|
183 |
+
files_ui,
|
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,
|
|
|
205 |
pt_scores,
|
206 |
csv_pt_scores,
|
207 |
step_2,
|
208 |
+
practical_tasks_column,
|
209 |
+
radio_create_ui(
|
210 |
+
practical_task,
|
211 |
+
config_data.Labels_PRACTICAL_TASKS_LABEL[lang_id],
|
212 |
+
current_lang_tasks,
|
213 |
+
config_data.InformationMessages_PRACTICAL_TASKS_INFO[lang_id],
|
214 |
+
True,
|
215 |
+
True,
|
216 |
+
),
|
217 |
+
radio_create_ui(
|
218 |
+
supported_practical_tasks[lang_id][practical_task][0],
|
219 |
+
config_data.Labels_PRACTICAL_SUBTASKS_LABEL[lang_id],
|
220 |
+
supported_practical_tasks[lang_id][practical_task],
|
221 |
+
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO[lang_id],
|
222 |
+
True,
|
223 |
+
True,
|
224 |
+
),
|
225 |
)
|
app/event_handlers/practical_subtasks.py
CHANGED
@@ -9,25 +9,36 @@ 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,
|
|
|
13 |
from app.components import number_create_ui, dropdown_create_ui
|
14 |
|
15 |
|
16 |
def event_handler_practical_subtasks(
|
17 |
-
|
|
|
|
|
|
|
|
|
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=
|
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=
|
31 |
elem_classes="dropdown-container",
|
32 |
),
|
33 |
number_create_ui(
|
@@ -39,7 +50,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=
|
43 |
render=True,
|
44 |
elem_classes="number-container",
|
45 |
),
|
@@ -62,17 +73,9 @@ def event_handler_practical_subtasks(
|
|
62 |
number_create_ui(visible=False),
|
63 |
)
|
64 |
elif practical_subtasks.lower() == "professional groups":
|
65 |
-
df_traits_priority_for_professions = read_csv_file(
|
66 |
-
config_data.Links_PROFESSIONS
|
67 |
-
)
|
68 |
-
weights_professions, interactive_professions = extract_profession_weights(
|
69 |
-
df_traits_priority_for_professions,
|
70 |
-
config_data.Settings_DROPDOWN_CANDIDATES[0],
|
71 |
-
)
|
72 |
-
|
73 |
return (
|
74 |
practical_subtasks_selected,
|
75 |
-
gr.Column(visible=
|
76 |
dropdown_create_ui(visible=False),
|
77 |
number_create_ui(visible=False),
|
78 |
number_create_ui(visible=False),
|
@@ -91,7 +94,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=
|
95 |
elem_classes="dropdown-container",
|
96 |
),
|
97 |
number_create_ui(
|
@@ -105,7 +108,7 @@ def event_handler_practical_subtasks(
|
|
105 |
),
|
106 |
show_label=True,
|
107 |
interactive=interactive_professions,
|
108 |
-
visible=
|
109 |
render=True,
|
110 |
elem_classes="number-container",
|
111 |
),
|
@@ -120,7 +123,7 @@ def event_handler_practical_subtasks(
|
|
120 |
),
|
121 |
show_label=True,
|
122 |
interactive=interactive_professions,
|
123 |
-
visible=
|
124 |
render=True,
|
125 |
elem_classes="number-container",
|
126 |
),
|
@@ -135,7 +138,7 @@ def event_handler_practical_subtasks(
|
|
135 |
),
|
136 |
show_label=True,
|
137 |
interactive=interactive_professions,
|
138 |
-
visible=
|
139 |
render=True,
|
140 |
elem_classes="number-container",
|
141 |
),
|
@@ -150,7 +153,7 @@ def event_handler_practical_subtasks(
|
|
150 |
),
|
151 |
show_label=True,
|
152 |
interactive=interactive_professions,
|
153 |
-
visible=
|
154 |
render=True,
|
155 |
elem_classes="number-container",
|
156 |
),
|
@@ -165,7 +168,7 @@ def event_handler_practical_subtasks(
|
|
165 |
),
|
166 |
show_label=True,
|
167 |
interactive=interactive_professions,
|
168 |
-
visible=
|
169 |
render=True,
|
170 |
elem_classes="number-container",
|
171 |
),
|
@@ -173,7 +176,7 @@ def event_handler_practical_subtasks(
|
|
173 |
elif practical_subtasks.lower() == "professional skills":
|
174 |
return (
|
175 |
practical_subtasks_selected,
|
176 |
-
gr.Column(visible=
|
177 |
dropdown_create_ui(visible=False),
|
178 |
number_create_ui(visible=False),
|
179 |
number_create_ui(
|
@@ -185,7 +188,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=
|
189 |
render=True,
|
190 |
elem_classes="number-container",
|
191 |
),
|
@@ -194,7 +197,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=
|
198 |
elem_classes="dropdown-container",
|
199 |
),
|
200 |
number_create_ui(visible=False),
|
@@ -216,10 +219,12 @@ def event_handler_practical_subtasks(
|
|
216 |
elif (
|
217 |
practical_subtasks.lower() == "finding a suitable junior colleague"
|
218 |
or practical_subtasks.lower() == "finding a suitable senior colleague"
|
|
|
|
|
219 |
):
|
220 |
return (
|
221 |
practical_subtasks_selected,
|
222 |
-
gr.Column(visible=
|
223 |
dropdown_create_ui(visible=False),
|
224 |
number_create_ui(visible=False),
|
225 |
number_create_ui(visible=False),
|
@@ -233,7 +238,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=
|
237 |
render=True,
|
238 |
elem_classes="number-container",
|
239 |
),
|
@@ -246,7 +251,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=
|
250 |
render=True,
|
251 |
elem_classes="number-container",
|
252 |
),
|
@@ -259,7 +264,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=
|
263 |
render=True,
|
264 |
elem_classes="number-container",
|
265 |
),
|
@@ -272,7 +277,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=
|
276 |
render=True,
|
277 |
elem_classes="number-container",
|
278 |
),
|
@@ -285,7 +290,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=
|
289 |
render=True,
|
290 |
elem_classes="number-container",
|
291 |
),
|
@@ -294,11 +299,16 @@ def event_handler_practical_subtasks(
|
|
294 |
minimum=0.0,
|
295 |
maximum=1.0,
|
296 |
step=0.01,
|
297 |
-
label=
|
|
|
|
|
|
|
|
|
|
|
298 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
299 |
show_label=True,
|
300 |
interactive=True,
|
301 |
-
visible=
|
302 |
render=True,
|
303 |
elem_classes="number-container",
|
304 |
),
|
@@ -315,7 +325,7 @@ def event_handler_practical_subtasks(
|
|
315 |
elif (
|
316 |
practical_subtasks.lower() == "car characteristics"
|
317 |
or practical_subtasks.lower() == "mobile device application categories"
|
318 |
-
or practical_subtasks.lower() == "clothing
|
319 |
):
|
320 |
if practical_subtasks.lower() == "car characteristics":
|
321 |
|
@@ -330,12 +340,12 @@ def event_handler_practical_subtasks(
|
|
330 |
config_data.Links_MDA_CATEGORIES
|
331 |
)
|
332 |
|
333 |
-
elif practical_subtasks.lower() == "clothing
|
334 |
df_correlation_coefficients = read_csv_file(config_data.Links_CLOTHING_SC)
|
335 |
|
336 |
return (
|
337 |
practical_subtasks_selected,
|
338 |
-
gr.Column(visible=
|
339 |
dropdown_create_ui(visible=False),
|
340 |
number_create_ui(visible=False),
|
341 |
number_create_ui(visible=False),
|
@@ -349,15 +359,24 @@ def event_handler_practical_subtasks(
|
|
349 |
number_create_ui(
|
350 |
value=1,
|
351 |
minimum=1,
|
352 |
-
maximum=
|
|
|
|
|
|
|
|
|
353 |
step=1,
|
354 |
label=config_data.Labels_NUMBER_PRIORITY_LABEL,
|
355 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(
|
356 |
-
1,
|
|
|
|
|
|
|
|
|
|
|
357 |
),
|
358 |
show_label=True,
|
359 |
interactive=True,
|
360 |
-
visible=
|
361 |
render=True,
|
362 |
elem_classes="number-container",
|
363 |
),
|
@@ -370,7 +389,7 @@ def event_handler_practical_subtasks(
|
|
370 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(1, 5),
|
371 |
show_label=True,
|
372 |
interactive=True,
|
373 |
-
visible=
|
374 |
render=True,
|
375 |
elem_classes="number-container",
|
376 |
),
|
@@ -383,7 +402,7 @@ def event_handler_practical_subtasks(
|
|
383 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
384 |
show_label=True,
|
385 |
interactive=True,
|
386 |
-
visible=
|
387 |
render=True,
|
388 |
elem_classes="number-container",
|
389 |
),
|
|
|
9 |
|
10 |
# Importing necessary components for the Gradio app
|
11 |
from app.config import config_data
|
12 |
+
from app.utils import read_csv_file, get_language_settings
|
13 |
+
from app.data_init import weights_professions, interactive_professions
|
14 |
from app.components import number_create_ui, dropdown_create_ui
|
15 |
|
16 |
|
17 |
def event_handler_practical_subtasks(
|
18 |
+
language,
|
19 |
+
type_modes,
|
20 |
+
practical_tasks,
|
21 |
+
practical_subtasks,
|
22 |
+
practical_subtasks_selected,
|
23 |
):
|
24 |
+
lang_id, _ = get_language_settings(language)
|
25 |
+
|
26 |
practical_subtasks_selected[practical_tasks] = practical_subtasks
|
27 |
|
28 |
+
visible_subtasks = (
|
29 |
+
True if type_modes == config_data.Settings_TYPE_MODES[0] else False
|
30 |
+
)
|
31 |
+
|
32 |
if practical_subtasks.lower() == "16 personality types of mbti":
|
33 |
return (
|
34 |
practical_subtasks_selected,
|
35 |
+
gr.Column(visible=visible_subtasks),
|
36 |
dropdown_create_ui(
|
37 |
label=f"Potential candidates by Personality Type of MBTI ({len(config_data.Settings_DROPDOWN_MBTI)})",
|
38 |
info=config_data.InformationMessages_DROPDOWN_MBTI_INFO,
|
39 |
choices=config_data.Settings_DROPDOWN_MBTI,
|
40 |
value=config_data.Settings_DROPDOWN_MBTI[0],
|
41 |
+
visible=visible_subtasks,
|
42 |
elem_classes="dropdown-container",
|
43 |
),
|
44 |
number_create_ui(
|
|
|
50 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
51 |
show_label=True,
|
52 |
interactive=True,
|
53 |
+
visible=visible_subtasks,
|
54 |
render=True,
|
55 |
elem_classes="number-container",
|
56 |
),
|
|
|
73 |
number_create_ui(visible=False),
|
74 |
)
|
75 |
elif practical_subtasks.lower() == "professional groups":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
return (
|
77 |
practical_subtasks_selected,
|
78 |
+
gr.Column(visible=visible_subtasks),
|
79 |
dropdown_create_ui(visible=False),
|
80 |
number_create_ui(visible=False),
|
81 |
number_create_ui(visible=False),
|
|
|
94 |
info=config_data.InformationMessages_DROPDOWN_CANDIDATES_INFO,
|
95 |
choices=config_data.Settings_DROPDOWN_CANDIDATES,
|
96 |
value=config_data.Settings_DROPDOWN_CANDIDATES[0],
|
97 |
+
visible=visible_subtasks,
|
98 |
elem_classes="dropdown-container",
|
99 |
),
|
100 |
number_create_ui(
|
|
|
108 |
),
|
109 |
show_label=True,
|
110 |
interactive=interactive_professions,
|
111 |
+
visible=visible_subtasks,
|
112 |
render=True,
|
113 |
elem_classes="number-container",
|
114 |
),
|
|
|
123 |
),
|
124 |
show_label=True,
|
125 |
interactive=interactive_professions,
|
126 |
+
visible=visible_subtasks,
|
127 |
render=True,
|
128 |
elem_classes="number-container",
|
129 |
),
|
|
|
138 |
),
|
139 |
show_label=True,
|
140 |
interactive=interactive_professions,
|
141 |
+
visible=visible_subtasks,
|
142 |
render=True,
|
143 |
elem_classes="number-container",
|
144 |
),
|
|
|
153 |
),
|
154 |
show_label=True,
|
155 |
interactive=interactive_professions,
|
156 |
+
visible=visible_subtasks,
|
157 |
render=True,
|
158 |
elem_classes="number-container",
|
159 |
),
|
|
|
168 |
),
|
169 |
show_label=True,
|
170 |
interactive=interactive_professions,
|
171 |
+
visible=visible_subtasks,
|
172 |
render=True,
|
173 |
elem_classes="number-container",
|
174 |
),
|
|
|
176 |
elif practical_subtasks.lower() == "professional skills":
|
177 |
return (
|
178 |
practical_subtasks_selected,
|
179 |
+
gr.Column(visible=visible_subtasks),
|
180 |
dropdown_create_ui(visible=False),
|
181 |
number_create_ui(visible=False),
|
182 |
number_create_ui(
|
|
|
188 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
189 |
show_label=True,
|
190 |
interactive=True,
|
191 |
+
visible=visible_subtasks,
|
192 |
render=True,
|
193 |
elem_classes="number-container",
|
194 |
),
|
|
|
197 |
info=config_data.InformationMessages_DROPDOWN_PROFESSIONAL_SKILLS_INFO,
|
198 |
choices=config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS,
|
199 |
value=config_data.Settings_DROPDOWN_PROFESSIONAL_SKILLS[0],
|
200 |
+
visible=visible_subtasks,
|
201 |
elem_classes="dropdown-container",
|
202 |
),
|
203 |
number_create_ui(visible=False),
|
|
|
219 |
elif (
|
220 |
practical_subtasks.lower() == "finding a suitable junior colleague"
|
221 |
or practical_subtasks.lower() == "finding a suitable senior colleague"
|
222 |
+
or practical_subtasks.lower()
|
223 |
+
== "finding a suitable colleague by personality types"
|
224 |
):
|
225 |
return (
|
226 |
practical_subtasks_selected,
|
227 |
+
gr.Column(visible=visible_subtasks),
|
228 |
dropdown_create_ui(visible=False),
|
229 |
number_create_ui(visible=False),
|
230 |
number_create_ui(visible=False),
|
|
|
238 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
239 |
show_label=True,
|
240 |
interactive=True,
|
241 |
+
visible=visible_subtasks,
|
242 |
render=True,
|
243 |
elem_classes="number-container",
|
244 |
),
|
|
|
251 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
252 |
show_label=True,
|
253 |
interactive=True,
|
254 |
+
visible=visible_subtasks,
|
255 |
render=True,
|
256 |
elem_classes="number-container",
|
257 |
),
|
|
|
264 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
265 |
show_label=True,
|
266 |
interactive=True,
|
267 |
+
visible=visible_subtasks,
|
268 |
render=True,
|
269 |
elem_classes="number-container",
|
270 |
),
|
|
|
277 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
278 |
show_label=True,
|
279 |
interactive=True,
|
280 |
+
visible=visible_subtasks,
|
281 |
render=True,
|
282 |
elem_classes="number-container",
|
283 |
),
|
|
|
290 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
291 |
show_label=True,
|
292 |
interactive=True,
|
293 |
+
visible=visible_subtasks,
|
294 |
render=True,
|
295 |
elem_classes="number-container",
|
296 |
),
|
|
|
299 |
minimum=0.0,
|
300 |
maximum=1.0,
|
301 |
step=0.01,
|
302 |
+
label=(
|
303 |
+
config_data.Labels_THRESHOLD_TARGET_SCORE_LABEL
|
304 |
+
if practical_subtasks.lower()
|
305 |
+
== "finding a suitable colleague by personality types"
|
306 |
+
else config_data.Labels_EQUAL_COEFFICIENT_LABEL
|
307 |
+
),
|
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 |
),
|
|
|
325 |
elif (
|
326 |
practical_subtasks.lower() == "car characteristics"
|
327 |
or practical_subtasks.lower() == "mobile device application categories"
|
328 |
+
or practical_subtasks.lower() == "clothing styles"
|
329 |
):
|
330 |
if practical_subtasks.lower() == "car characteristics":
|
331 |
|
|
|
340 |
config_data.Links_MDA_CATEGORIES
|
341 |
)
|
342 |
|
343 |
+
elif practical_subtasks.lower() == "clothing styles":
|
344 |
df_correlation_coefficients = read_csv_file(config_data.Links_CLOTHING_SC)
|
345 |
|
346 |
return (
|
347 |
practical_subtasks_selected,
|
348 |
+
gr.Column(visible=visible_subtasks),
|
349 |
dropdown_create_ui(visible=False),
|
350 |
number_create_ui(visible=False),
|
351 |
number_create_ui(visible=False),
|
|
|
359 |
number_create_ui(
|
360 |
value=1,
|
361 |
minimum=1,
|
362 |
+
maximum=(
|
363 |
+
df_correlation_coefficients.columns.size
|
364 |
+
if practical_subtasks.lower() == "car characteristics"
|
365 |
+
else df_correlation_coefficients.columns.size - 1
|
366 |
+
),
|
367 |
step=1,
|
368 |
label=config_data.Labels_NUMBER_PRIORITY_LABEL,
|
369 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(
|
370 |
+
1,
|
371 |
+
(
|
372 |
+
df_correlation_coefficients.columns.size
|
373 |
+
if practical_subtasks.lower() == "car characteristics"
|
374 |
+
else df_correlation_coefficients.columns.size - 1
|
375 |
+
),
|
376 |
),
|
377 |
show_label=True,
|
378 |
interactive=True,
|
379 |
+
visible=visible_subtasks,
|
380 |
render=True,
|
381 |
elem_classes="number-container",
|
382 |
),
|
|
|
389 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(1, 5),
|
390 |
show_label=True,
|
391 |
interactive=True,
|
392 |
+
visible=visible_subtasks,
|
393 |
render=True,
|
394 |
elem_classes="number-container",
|
395 |
),
|
|
|
402 |
info=config_data.InformationMessages_VALUE_FROM_TO_INFO.format(0, 1.0),
|
403 |
show_label=True,
|
404 |
interactive=True,
|
405 |
+
visible=visible_subtasks,
|
406 |
render=True,
|
407 |
elem_classes="number-container",
|
408 |
),
|
app/event_handlers/practical_task_sorted.py
CHANGED
@@ -15,16 +15,21 @@ from app.components import video_create_ui, textbox_create_ui
|
|
15 |
|
16 |
|
17 |
def event_handler_practical_task_sorted(
|
18 |
-
files, practical_task_sorted, evt_data: gr.SelectData
|
19 |
):
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
25 |
)
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
|
29 |
if evt_data.index[0] == 0:
|
30 |
label = "Best"
|
@@ -32,7 +37,13 @@ def event_handler_practical_task_sorted(
|
|
32 |
label = ""
|
33 |
label += " " + config_data.Dataframes_PT_SCORES[0][0]
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
person_metadata_list = video_metadata[Path(files[person_id]).name]
|
37 |
|
38 |
person_metadata = (
|
|
|
15 |
|
16 |
|
17 |
def event_handler_practical_task_sorted(
|
18 |
+
type_modes, files, video, practical_task_sorted, evt_data: gr.SelectData
|
19 |
):
|
20 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
21 |
+
person_id = (
|
22 |
+
int(
|
23 |
+
practical_task_sorted.iloc[evt_data.index[0]][
|
24 |
+
config_data.Dataframes_PT_SCORES[0][0]
|
25 |
+
]
|
26 |
+
)
|
27 |
+
- 1
|
28 |
)
|
29 |
+
elif type_modes == config_data.Settings_TYPE_MODES[1]:
|
30 |
+
files = [video]
|
31 |
+
|
32 |
+
person_id = 0
|
33 |
|
34 |
if evt_data.index[0] == 0:
|
35 |
label = "Best"
|
|
|
37 |
label = ""
|
38 |
label += " " + config_data.Dataframes_PT_SCORES[0][0]
|
39 |
|
40 |
+
try:
|
41 |
+
is_filename = Path(files[person_id]).name in video_metadata
|
42 |
+
except IndexError:
|
43 |
+
is_filename = False
|
44 |
+
person_id = 0
|
45 |
+
|
46 |
+
if is_filename:
|
47 |
person_metadata_list = video_metadata[Path(files[person_id]).name]
|
48 |
|
49 |
person_metadata = (
|
app/event_handlers/practical_tasks.py
CHANGED
@@ -9,14 +9,32 @@ License: MIT License
|
|
9 |
from app.config import config_data
|
10 |
from app.practical_tasks import supported_practical_tasks
|
11 |
from app.components import radio_create_ui
|
|
|
12 |
|
13 |
|
14 |
-
def event_handler_practical_tasks(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
return radio_create_ui(
|
16 |
practical_subtasks_selected[practical_tasks],
|
17 |
-
config_data.Labels_PRACTICAL_SUBTASKS_LABEL,
|
18 |
-
|
19 |
-
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO,
|
20 |
True,
|
21 |
True,
|
22 |
)
|
|
|
9 |
from app.config import config_data
|
10 |
from app.practical_tasks import supported_practical_tasks
|
11 |
from app.components import radio_create_ui
|
12 |
+
from app.utils import get_language_settings
|
13 |
|
14 |
|
15 |
+
def event_handler_practical_tasks(
|
16 |
+
language, type_modes, practical_tasks, practical_subtasks_selected
|
17 |
+
):
|
18 |
+
lang_id, _ = get_language_settings(language)
|
19 |
+
|
20 |
+
if type_modes == config_data.Settings_TYPE_MODES[0]:
|
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 |
+
|
28 |
+
supported_practical_tasks_ren = [
|
29 |
+
{rename_map.get(k, k): v for k, v in d.items()}
|
30 |
+
for d in supported_practical_tasks
|
31 |
+
]
|
32 |
+
|
33 |
return radio_create_ui(
|
34 |
practical_subtasks_selected[practical_tasks],
|
35 |
+
config_data.Labels_PRACTICAL_SUBTASKS_LABEL[lang_id],
|
36 |
+
supported_practical_tasks_ren[lang_id][practical_tasks],
|
37 |
+
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO[lang_id],
|
38 |
True,
|
39 |
True,
|
40 |
)
|
app/event_handlers/switching_modes.py
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
File: switching_modes.py
|
3 |
+
Author: Elena Ryumina and Dmitry Ryumin
|
4 |
+
Description: Event handler for switching modes.
|
5 |
+
License: MIT License
|
6 |
+
"""
|
7 |
+
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
# Importing necessary components for the Gradio app
|
11 |
+
from app.config import config_data
|
12 |
+
from app.description_steps import STEP_2
|
13 |
+
from app.practical_tasks import supported_practical_tasks
|
14 |
+
from app.components import (
|
15 |
+
html_message,
|
16 |
+
files_create_ui,
|
17 |
+
video_create_ui,
|
18 |
+
button,
|
19 |
+
dataframe,
|
20 |
+
radio_create_ui,
|
21 |
+
number_create_ui,
|
22 |
+
dropdown_create_ui,
|
23 |
+
textbox_create_ui,
|
24 |
+
)
|
25 |
+
from app.utils import get_language_settings
|
26 |
+
|
27 |
+
|
28 |
+
def event_handler_switching_modes(language, type_modes):
|
29 |
+
lang_id, _ = get_language_settings(language)
|
30 |
+
|
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],
|
47 |
+
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
48 |
+
),
|
49 |
+
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
|
50 |
+
interactive=False,
|
51 |
+
visible=False,
|
52 |
+
)
|
53 |
+
webcam = gr.Video(interactive=True, visible=True)
|
54 |
+
switching_modes = button(
|
55 |
+
config_data.OtherMessages_SWITCHEHG_MODES_OFFLINE[lang_id],
|
56 |
+
True,
|
57 |
+
1,
|
58 |
+
"./images/videos.ico",
|
59 |
+
True,
|
60 |
+
"switching_modes",
|
61 |
+
)
|
62 |
+
type_modes_ui = gr.Radio(
|
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],
|
84 |
+
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
85 |
+
),
|
86 |
+
file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
|
87 |
+
)
|
88 |
+
webcam = gr.Video(interactive=False, visible=False)
|
89 |
+
switching_modes = button(
|
90 |
+
config_data.OtherMessages_SWITCHEHG_MODES_ONLINE[lang_id],
|
91 |
+
True,
|
92 |
+
1,
|
93 |
+
"./images/webcam.ico",
|
94 |
+
True,
|
95 |
+
"switching_modes",
|
96 |
+
)
|
97 |
+
type_modes_ui = gr.Radio(
|
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,
|
121 |
+
3,
|
122 |
+
"./images/calculate_pt_scores.ico",
|
123 |
+
True,
|
124 |
+
"calculate_oceanai",
|
125 |
+
),
|
126 |
+
button(
|
127 |
+
config_data.OtherMessages_CLEAR_APP[lang_id],
|
128 |
+
False,
|
129 |
+
1,
|
130 |
+
"./images/clear.ico",
|
131 |
+
True,
|
132 |
+
"clear_oceanai",
|
133 |
+
),
|
134 |
+
dataframe(visible=False),
|
135 |
+
files_create_ui(
|
136 |
+
None,
|
137 |
+
"single",
|
138 |
+
[".csv"],
|
139 |
+
config_data.OtherMessages_EXPORT_PT_SCORES[lang_id],
|
140 |
+
True,
|
141 |
+
False,
|
142 |
+
False,
|
143 |
+
"csv-container",
|
144 |
+
),
|
145 |
+
gr.HTML(value=STEP_2[lang_id], visible=False),
|
146 |
+
gr.Column(visible=False),
|
147 |
+
radio_create_ui(
|
148 |
+
first_practical_task,
|
149 |
+
config_data.Labels_PRACTICAL_TASKS_LABEL[lang_id],
|
150 |
+
list(map(str, supported_practical_tasks[lang_id].keys())),
|
151 |
+
config_data.InformationMessages_PRACTICAL_TASKS_INFO[lang_id],
|
152 |
+
True,
|
153 |
+
True,
|
154 |
+
),
|
155 |
+
radio_create_ui(
|
156 |
+
supported_practical_tasks[lang_id][first_practical_task][0],
|
157 |
+
config_data.Labels_PRACTICAL_SUBTASKS_LABEL[lang_id],
|
158 |
+
supported_practical_tasks[lang_id][first_practical_task],
|
159 |
+
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO[lang_id],
|
160 |
+
True,
|
161 |
+
True,
|
162 |
+
),
|
163 |
+
gr.JSON(
|
164 |
+
value={
|
165 |
+
str(task): supported_practical_tasks[index].get(task, [None])[0]
|
166 |
+
for index in range(len(supported_practical_tasks))
|
167 |
+
for task in supported_practical_tasks[index].keys()
|
168 |
+
},
|
169 |
+
visible=False,
|
170 |
+
render=True,
|
171 |
+
),
|
172 |
+
gr.Column(visible=False),
|
173 |
+
dropdown_create_ui(visible=False),
|
174 |
+
number_create_ui(visible=False),
|
175 |
+
number_create_ui(visible=False),
|
176 |
+
dropdown_create_ui(visible=False),
|
177 |
+
number_create_ui(visible=False),
|
178 |
+
number_create_ui(visible=False),
|
179 |
+
number_create_ui(visible=False),
|
180 |
+
number_create_ui(visible=False),
|
181 |
+
number_create_ui(visible=False),
|
182 |
+
number_create_ui(visible=False),
|
183 |
+
number_create_ui(visible=False),
|
184 |
+
number_create_ui(visible=False),
|
185 |
+
number_create_ui(visible=False),
|
186 |
+
dropdown_create_ui(visible=False),
|
187 |
+
number_create_ui(visible=False),
|
188 |
+
number_create_ui(visible=False),
|
189 |
+
number_create_ui(visible=False),
|
190 |
+
number_create_ui(visible=False),
|
191 |
+
number_create_ui(visible=False),
|
192 |
+
gr.Row(visible=False),
|
193 |
+
gr.Column(visible=False),
|
194 |
+
dataframe(visible=False),
|
195 |
+
files_create_ui(
|
196 |
+
None,
|
197 |
+
"single",
|
198 |
+
[".csv"],
|
199 |
+
config_data.OtherMessages_EXPORT_PS,
|
200 |
+
True,
|
201 |
+
False,
|
202 |
+
False,
|
203 |
+
"csv-container",
|
204 |
+
),
|
205 |
+
gr.Accordion(visible=False),
|
206 |
+
gr.HTML(visible=False),
|
207 |
+
dataframe(visible=False),
|
208 |
+
gr.Column(visible=False),
|
209 |
+
video_create_ui(visible=False),
|
210 |
+
gr.Column(visible=False),
|
211 |
+
gr.Row(visible=False),
|
212 |
+
gr.Row(visible=False),
|
213 |
+
gr.Image(visible=False),
|
214 |
+
textbox_create_ui(visible=False),
|
215 |
+
gr.Row(visible=False),
|
216 |
+
gr.Image(visible=False),
|
217 |
+
textbox_create_ui(visible=False),
|
218 |
+
gr.Row(visible=False),
|
219 |
+
gr.Row(visible=False),
|
220 |
+
gr.Image(visible=False),
|
221 |
+
textbox_create_ui(visible=False),
|
222 |
+
gr.Row(visible=False),
|
223 |
+
gr.Image(visible=False),
|
224 |
+
textbox_create_ui(visible=False),
|
225 |
+
html_message(config_data.InformationMessages_NOTI_IN_DEV, False, False),
|
226 |
+
)
|
app/event_handlers/webcam.py
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
File: webcam.py
|
3 |
+
Author: Elena Ryumina and Dmitry Ryumin
|
4 |
+
Description: Event handler for webcam.
|
5 |
+
License: MIT License
|
6 |
+
"""
|
7 |
+
|
8 |
+
import gradio as gr
|
9 |
+
from pathlib import Path
|
10 |
+
|
11 |
+
# Importing necessary components for the Gradio app
|
12 |
+
from app.config import config_data
|
13 |
+
from app.components import html_message, video_create_ui, button
|
14 |
+
from app.utils import get_language_settings, webm2mp4
|
15 |
+
|
16 |
+
|
17 |
+
def event_handler_webcam(language, webcam, pt_scores):
|
18 |
+
lang_id, _ = get_language_settings(language)
|
19 |
+
|
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",
|
31 |
+
),
|
32 |
+
video_create_ui(label=config_data.OtherMessages_VIDEO_PLAYER[lang_id]),
|
33 |
+
gr.Video(value=None),
|
34 |
+
button(
|
35 |
+
config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
|
36 |
+
False,
|
37 |
+
3,
|
38 |
+
"./images/calculate_pt_scores.ico",
|
39 |
+
True,
|
40 |
+
"calculate_oceanai",
|
41 |
+
),
|
42 |
+
button(
|
43 |
+
config_data.OtherMessages_CLEAR_APP[lang_id],
|
44 |
+
False,
|
45 |
+
1,
|
46 |
+
"./images/clear.ico",
|
47 |
+
True,
|
48 |
+
"clear_oceanai",
|
49 |
+
),
|
50 |
+
)
|
51 |
+
|
52 |
+
if webcam.split(".")[-1] == "webm":
|
53 |
+
webcam = webm2mp4(webcam)
|
54 |
+
|
55 |
+
return (
|
56 |
+
html_message(
|
57 |
+
config_data.OtherMessages_NOTI_CALCULATE[lang_id],
|
58 |
+
True,
|
59 |
+
False if pt_scores.shape[1] >= 7 else True,
|
60 |
+
"notifications",
|
61 |
+
),
|
62 |
+
video_create_ui(
|
63 |
+
value=webcam,
|
64 |
+
label=config_data.OtherMessages_VIDEO_PLAYER[lang_id],
|
65 |
+
file_name=Path(Path(webcam).name).name,
|
66 |
+
),
|
67 |
+
gr.Video(value=None),
|
68 |
+
button(
|
69 |
+
config_data.OtherMessages_CALCULATE_PT_SCORES[lang_id],
|
70 |
+
True,
|
71 |
+
3,
|
72 |
+
"./images/calculate_pt_scores.ico",
|
73 |
+
True,
|
74 |
+
"calculate_oceanai",
|
75 |
+
),
|
76 |
+
button(
|
77 |
+
config_data.OtherMessages_CLEAR_APP[lang_id],
|
78 |
+
True,
|
79 |
+
1,
|
80 |
+
"./images/clear.ico",
|
81 |
+
True,
|
82 |
+
"clear_oceanai",
|
83 |
+
),
|
84 |
+
)
|
app/port.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
File: port.py
|
3 |
+
Author: Elena Ryumina and Dmitry Ryumin
|
4 |
+
Description: Utility functions to check and free ports by terminating processes holding them.
|
5 |
+
License: MIT License
|
6 |
+
"""
|
7 |
+
|
8 |
+
import socket
|
9 |
+
import psutil
|
10 |
+
from typing import Iterable, Union
|
11 |
+
|
12 |
+
|
13 |
+
def is_port_in_use(host: str, port: int) -> bool:
|
14 |
+
try:
|
15 |
+
with socket.create_connection((host, port), timeout=1):
|
16 |
+
return True
|
17 |
+
except (ConnectionRefusedError, OSError):
|
18 |
+
return False
|
19 |
+
|
20 |
+
|
21 |
+
def free_ports(ports: Union[int, Iterable[int]]) -> None:
|
22 |
+
ports_to_free = {ports} if isinstance(ports, int) else set(ports)
|
23 |
+
|
24 |
+
for proc in psutil.process_iter(attrs=["pid", "name"]):
|
25 |
+
try:
|
26 |
+
connections = proc.net_connections(kind="inet")
|
27 |
+
for conn in connections:
|
28 |
+
if conn.laddr.port in ports_to_free:
|
29 |
+
proc.terminate()
|
30 |
+
proc.wait()
|
31 |
+
ports_to_free.discard(conn.laddr.port)
|
32 |
+
if not ports_to_free:
|
33 |
+
return
|
34 |
+
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
|
35 |
+
continue
|
app/practical_tasks.py
CHANGED
@@ -11,17 +11,27 @@ from typing import Dict, List
|
|
11 |
# Importing necessary components for the Gradio app
|
12 |
|
13 |
|
14 |
-
def load_practical_tasks_data(
|
15 |
-
|
16 |
-
return yaml.safe_load(file) or []
|
17 |
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
output_dict = {item["task"]: item["subtasks"] for item in data}
|
21 |
|
22 |
-
return output_dict
|
23 |
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
supported_practical_tasks = transform_practical_tasks_data(practical_tasks_data)
|
|
|
11 |
# Importing necessary components for the Gradio app
|
12 |
|
13 |
|
14 |
+
def load_practical_tasks_data(file_paths: List[str]) -> List[Dict]:
|
15 |
+
all_tasks_data = []
|
|
|
16 |
|
17 |
+
for file_path in file_paths:
|
18 |
+
with open(file_path, "r") as file:
|
19 |
+
data = yaml.safe_load(file) or []
|
20 |
+
all_tasks_data.append(data)
|
21 |
|
22 |
+
return all_tasks_data
|
|
|
23 |
|
|
|
24 |
|
25 |
+
def transform_practical_tasks_data(data: List[Dict]) -> List[Dict]:
|
26 |
+
output_list = []
|
27 |
|
28 |
+
for task_data in data:
|
29 |
+
output_dict = {item["task"]: item["subtasks"] for item in task_data}
|
30 |
+
output_list.append(output_dict)
|
31 |
+
|
32 |
+
return output_list
|
33 |
+
|
34 |
+
|
35 |
+
yaml_file_paths = ["./practical_tasks_en.yaml", "./practical_tasks_ru.yaml"]
|
36 |
+
practical_tasks_data = load_practical_tasks_data(yaml_file_paths)
|
37 |
supported_practical_tasks = transform_practical_tasks_data(practical_tasks_data)
|
app/tabs.py
CHANGED
@@ -13,10 +13,11 @@ from app.description_steps import STEP_1, STEP_2
|
|
13 |
from app.mbti_description import MBTI_DESCRIPTION, MBTI_DATA
|
14 |
from app.app import APP
|
15 |
from app.authors import AUTHORS
|
|
|
16 |
from app.requirements_app import read_requirements_to_df
|
17 |
from app.config import config_data
|
18 |
from app.practical_tasks import supported_practical_tasks
|
19 |
-
from app.utils import read_csv_file
|
20 |
from app.components import (
|
21 |
html_message,
|
22 |
files_create_ui,
|
@@ -37,16 +38,59 @@ def app_tab():
|
|
37 |
|
38 |
step_1 = gr.HTML(value=STEP_1[config_data.AppSettings_DEFAULT_LANG_ID])
|
39 |
|
40 |
-
with gr.Row():
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
config_data.AppSettings_DEFAULT_LANG_ID
|
45 |
],
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
video = video_create_ui()
|
52 |
|
@@ -87,6 +131,7 @@ def app_tab():
|
|
87 |
config_data.AppSettings_DEFAULT_LANG_ID
|
88 |
],
|
89 |
False,
|
|
|
90 |
)
|
91 |
|
92 |
pt_scores = dataframe(visible=False)
|
@@ -108,23 +153,42 @@ def app_tab():
|
|
108 |
value=STEP_2[config_data.AppSettings_DEFAULT_LANG_ID], visible=False
|
109 |
)
|
110 |
|
111 |
-
first_practical_task = next(
|
|
|
|
|
112 |
|
113 |
with gr.Column(scale=1, visible=False, render=True) as practical_tasks_column:
|
114 |
practical_tasks = radio_create_ui(
|
115 |
first_practical_task,
|
116 |
config_data.Labels_PRACTICAL_TASKS_LABEL,
|
117 |
-
list(
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
True,
|
120 |
True,
|
121 |
)
|
122 |
|
123 |
practical_subtasks = radio_create_ui(
|
124 |
-
supported_practical_tasks[
|
125 |
-
|
126 |
-
|
127 |
-
config_data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
True,
|
129 |
True,
|
130 |
)
|
@@ -159,7 +223,7 @@ def app_tab():
|
|
159 |
)
|
160 |
|
161 |
threshold_professional_skills = number_create_ui(
|
162 |
-
value=0.
|
163 |
minimum=0.0,
|
164 |
maximum=1.0,
|
165 |
step=0.01,
|
@@ -323,14 +387,6 @@ def app_tab():
|
|
323 |
elem_classes="dropdown-container",
|
324 |
)
|
325 |
|
326 |
-
df_traits_priority_for_professions = read_csv_file(
|
327 |
-
config_data.Links_PROFESSIONS
|
328 |
-
)
|
329 |
-
weights_professions, interactive_professions = extract_profession_weights(
|
330 |
-
df_traits_priority_for_professions,
|
331 |
-
config_data.Settings_DROPDOWN_CANDIDATES[0],
|
332 |
-
)
|
333 |
-
|
334 |
number_openness = number_create_ui(
|
335 |
value=weights_professions[0],
|
336 |
minimum=config_data.Values_0_100[0],
|
@@ -481,6 +537,7 @@ def app_tab():
|
|
481 |
visible=False,
|
482 |
show_download_button=False,
|
483 |
elem_classes="metadata_name-logo",
|
|
|
484 |
)
|
485 |
|
486 |
name = textbox_create_ui(
|
@@ -512,6 +569,7 @@ def app_tab():
|
|
512 |
visible=False,
|
513 |
show_download_button=False,
|
514 |
elem_classes="metadata_surname-logo",
|
|
|
515 |
)
|
516 |
|
517 |
surname = textbox_create_ui(
|
@@ -545,6 +603,7 @@ def app_tab():
|
|
545 |
visible=False,
|
546 |
show_download_button=False,
|
547 |
elem_classes="metadata_email-logo",
|
|
|
548 |
)
|
549 |
|
550 |
email = textbox_create_ui(
|
@@ -576,6 +635,7 @@ def app_tab():
|
|
576 |
visible=False,
|
577 |
show_download_button=False,
|
578 |
elem_classes="metadata_phone-logo",
|
|
|
579 |
)
|
580 |
|
581 |
phone = textbox_create_ui(
|
@@ -595,8 +655,9 @@ def app_tab():
|
|
595 |
|
596 |
practical_subtasks_selected = gr.JSON(
|
597 |
value={
|
598 |
-
str(task): supported_practical_tasks.get(task, [None])[0]
|
599 |
-
for
|
|
|
600 |
},
|
601 |
visible=False,
|
602 |
render=True,
|
@@ -611,6 +672,9 @@ def app_tab():
|
|
611 |
step_1,
|
612 |
notifications,
|
613 |
files,
|
|
|
|
|
|
|
614 |
video,
|
615 |
examples,
|
616 |
calculate_pt_scores,
|
|
|
13 |
from app.mbti_description import MBTI_DESCRIPTION, MBTI_DATA
|
14 |
from app.app import APP
|
15 |
from app.authors import AUTHORS
|
16 |
+
from app.data_init import weights_professions, interactive_professions
|
17 |
from app.requirements_app import read_requirements_to_df
|
18 |
from app.config import config_data
|
19 |
from app.practical_tasks import supported_practical_tasks
|
20 |
+
from app.utils import read_csv_file
|
21 |
from app.components import (
|
22 |
html_message,
|
23 |
files_create_ui,
|
|
|
38 |
|
39 |
step_1 = gr.HTML(value=STEP_1[config_data.AppSettings_DEFAULT_LANG_ID])
|
40 |
|
41 |
+
with gr.Row(elem_classes="media-container"):
|
42 |
+
with gr.Column():
|
43 |
+
files = files_create_ui(
|
44 |
+
label="{} ({})".format(
|
45 |
+
config_data.OtherMessages_VIDEO_FILES[
|
46 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
47 |
+
],
|
48 |
+
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
49 |
+
),
|
50 |
+
file_types=[
|
51 |
+
f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT
|
52 |
+
],
|
53 |
+
)
|
54 |
+
|
55 |
+
webcam = gr.Video(
|
56 |
+
label="{} ({})".format(
|
57 |
+
config_data.OtherMessages_VIDEO_FILES[
|
58 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
59 |
+
],
|
60 |
+
", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
|
61 |
+
),
|
62 |
+
show_label=True,
|
63 |
+
interactive=False,
|
64 |
+
visible=False,
|
65 |
+
mirror_webcam=False,
|
66 |
+
include_audio=True,
|
67 |
+
elem_classes="webcam",
|
68 |
+
autoplay=False,
|
69 |
+
)
|
70 |
+
|
71 |
+
switching_modes = button(
|
72 |
+
config_data.OtherMessages_SWITCHEHG_MODES_ONLINE[
|
73 |
config_data.AppSettings_DEFAULT_LANG_ID
|
74 |
],
|
75 |
+
True,
|
76 |
+
1,
|
77 |
+
"./images/webcam.ico",
|
78 |
+
True,
|
79 |
+
"switching_modes",
|
80 |
+
)
|
81 |
+
|
82 |
+
type_modes = gr.Radio(
|
83 |
+
choices=config_data.Settings_TYPE_MODES,
|
84 |
+
value=config_data.Settings_TYPE_MODES[0],
|
85 |
+
label=None,
|
86 |
+
info=None,
|
87 |
+
show_label=False,
|
88 |
+
container=False,
|
89 |
+
interactive=False,
|
90 |
+
visible=False,
|
91 |
+
render=True,
|
92 |
+
elem_classes="type_modes",
|
93 |
+
)
|
94 |
|
95 |
video = video_create_ui()
|
96 |
|
|
|
131 |
config_data.AppSettings_DEFAULT_LANG_ID
|
132 |
],
|
133 |
False,
|
134 |
+
"notifications",
|
135 |
)
|
136 |
|
137 |
pt_scores = dataframe(visible=False)
|
|
|
153 |
value=STEP_2[config_data.AppSettings_DEFAULT_LANG_ID], visible=False
|
154 |
)
|
155 |
|
156 |
+
first_practical_task = next(
|
157 |
+
iter(supported_practical_tasks[config_data.AppSettings_DEFAULT_LANG_ID])
|
158 |
+
)
|
159 |
|
160 |
with gr.Column(scale=1, visible=False, render=True) as practical_tasks_column:
|
161 |
practical_tasks = radio_create_ui(
|
162 |
first_practical_task,
|
163 |
config_data.Labels_PRACTICAL_TASKS_LABEL,
|
164 |
+
list(
|
165 |
+
map(
|
166 |
+
str,
|
167 |
+
supported_practical_tasks[
|
168 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
169 |
+
].keys(),
|
170 |
+
)
|
171 |
+
),
|
172 |
+
config_data.InformationMessages_PRACTICAL_TASKS_INFO[
|
173 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
174 |
+
],
|
175 |
True,
|
176 |
True,
|
177 |
)
|
178 |
|
179 |
practical_subtasks = radio_create_ui(
|
180 |
+
supported_practical_tasks[config_data.AppSettings_DEFAULT_LANG_ID][
|
181 |
+
first_practical_task
|
182 |
+
][0],
|
183 |
+
config_data.Labels_PRACTICAL_SUBTASKS_LABEL[
|
184 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
185 |
+
],
|
186 |
+
supported_practical_tasks[config_data.AppSettings_DEFAULT_LANG_ID][
|
187 |
+
first_practical_task
|
188 |
+
],
|
189 |
+
config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO[
|
190 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
191 |
+
],
|
192 |
True,
|
193 |
True,
|
194 |
)
|
|
|
223 |
)
|
224 |
|
225 |
threshold_professional_skills = number_create_ui(
|
226 |
+
value=0.5,
|
227 |
minimum=0.0,
|
228 |
maximum=1.0,
|
229 |
step=0.01,
|
|
|
387 |
elem_classes="dropdown-container",
|
388 |
)
|
389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
number_openness = number_create_ui(
|
391 |
value=weights_professions[0],
|
392 |
minimum=config_data.Values_0_100[0],
|
|
|
537 |
visible=False,
|
538 |
show_download_button=False,
|
539 |
elem_classes="metadata_name-logo",
|
540 |
+
show_fullscreen_button=False,
|
541 |
)
|
542 |
|
543 |
name = textbox_create_ui(
|
|
|
569 |
visible=False,
|
570 |
show_download_button=False,
|
571 |
elem_classes="metadata_surname-logo",
|
572 |
+
show_fullscreen_button=False,
|
573 |
)
|
574 |
|
575 |
surname = textbox_create_ui(
|
|
|
603 |
visible=False,
|
604 |
show_download_button=False,
|
605 |
elem_classes="metadata_email-logo",
|
606 |
+
show_fullscreen_button=False,
|
607 |
)
|
608 |
|
609 |
email = textbox_create_ui(
|
|
|
635 |
visible=False,
|
636 |
show_download_button=False,
|
637 |
elem_classes="metadata_phone-logo",
|
638 |
+
show_fullscreen_button=False,
|
639 |
)
|
640 |
|
641 |
phone = textbox_create_ui(
|
|
|
655 |
|
656 |
practical_subtasks_selected = gr.JSON(
|
657 |
value={
|
658 |
+
str(task): supported_practical_tasks[index].get(task, [None])[0]
|
659 |
+
for index in range(len(supported_practical_tasks))
|
660 |
+
for task in supported_practical_tasks[index].keys()
|
661 |
},
|
662 |
visible=False,
|
663 |
render=True,
|
|
|
672 |
step_1,
|
673 |
notifications,
|
674 |
files,
|
675 |
+
webcam,
|
676 |
+
switching_modes,
|
677 |
+
type_modes,
|
678 |
video,
|
679 |
examples,
|
680 |
calculate_pt_scores,
|
app/utils.py
CHANGED
@@ -6,6 +6,8 @@ License: MIT License
|
|
6 |
"""
|
7 |
|
8 |
import pandas as pd
|
|
|
|
|
9 |
|
10 |
# Importing necessary components for the Gradio app
|
11 |
from app.config import config_data
|
@@ -84,3 +86,27 @@ def extract_profession_weights(df, dropdown_candidates):
|
|
84 |
weights_professions = list(map(int, weights_professions))
|
85 |
|
86 |
return weights_professions, interactive_professions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
"""
|
7 |
|
8 |
import pandas as pd
|
9 |
+
import subprocess
|
10 |
+
from pathlib import Path
|
11 |
|
12 |
# Importing necessary components for the Gradio app
|
13 |
from app.config import config_data
|
|
|
86 |
weights_professions = list(map(int, weights_professions))
|
87 |
|
88 |
return weights_professions, interactive_professions
|
89 |
+
|
90 |
+
|
91 |
+
def webm2mp4(input_file):
|
92 |
+
input_path = Path(input_file)
|
93 |
+
output_path = input_path.with_suffix(".mp4")
|
94 |
+
|
95 |
+
if not output_path.exists():
|
96 |
+
subprocess.run(
|
97 |
+
[
|
98 |
+
"ffmpeg",
|
99 |
+
"-i",
|
100 |
+
str(input_path),
|
101 |
+
"-c:v",
|
102 |
+
"copy",
|
103 |
+
"-c:a",
|
104 |
+
"aac",
|
105 |
+
"-strict",
|
106 |
+
"experimental",
|
107 |
+
str(output_path),
|
108 |
+
],
|
109 |
+
check=True,
|
110 |
+
)
|
111 |
+
|
112 |
+
return str(output_path)
|
config.toml
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
[AppSettings]
|
2 |
-
APP_VERSION = "0.
|
|
|
|
|
3 |
CSS_PATH = "app.css"
|
4 |
DEFAULT_LANG_ID = 0
|
5 |
|
@@ -9,8 +11,8 @@ DESCRIPTIONS = [
|
|
9 |
"- библиотека с открытым исходным кодом для оценивания большой пятерки качеств личности человека и автоматизации HR-процессов",
|
10 |
]
|
11 |
NOTI_VIDEOS = ["Select the video(s)", "Выберите видео"]
|
12 |
-
PRACTICAL_TASKS_INFO = "Choose a practical task"
|
13 |
-
PRACTICAL_SUBTASKS_INFO = "Choose a practical subtask"
|
14 |
NOTI_IN_DEV = "In development"
|
15 |
DROPDOWN_MBTI_INFO = "What personality type indicator are you interested in?"
|
16 |
DROPDOWN_PROFESSIONAL_SKILLS_INFO = "What professional skill are you interested in?"
|
@@ -31,11 +33,18 @@ STEP_2 = [
|
|
31 |
[OtherMessages]
|
32 |
VIDEO_FILES = ["Video Files", "Видеофайлы"]
|
33 |
VIDEO_PLAYER = ["Video Player", "Видео проигрыватель"]
|
34 |
-
CALCULATE_PT_SCORES = [
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
CALCULATE_PRACTICAL_TASK = "Solving practical task"
|
37 |
CLEAR_APP = ["Clear", "Сброс"]
|
38 |
EXAMPLES_APP = ["Examples", "Примеры"]
|
|
|
39 |
EXPORT_PT_SCORES = [
|
40 |
"Export Big Five personality traits to a CSV file",
|
41 |
"Экспорт показателей Большой пятерки персональных качеств личности человека в CSV файл"]
|
@@ -45,14 +54,16 @@ EXPORT_WT = "Export ranking effective work teams results to a CSV file"
|
|
45 |
EXPORT_CP = "Export consumer preferences for industrial goods results to a CSV file"
|
46 |
EXPORT_MBTI = "Export ranking personality type results to a CSV file"
|
47 |
NOTI_CALCULATE = ["You can calculate Big Five personality traits scores", "Вы можете рассчитать показатели Большой пятерки персональных качеств личности человека"]
|
|
|
|
|
48 |
|
49 |
[Labels]
|
50 |
APP_LABEL = ["⭐ App", "⭐ Приложение"]
|
51 |
ABOUT_APP_LABEL = ["💡 About the App", "💡 О приложении"]
|
52 |
ABOUT_AUTHORS_LABEL = ["🎭 About the Authors", "🎭 Об авторах"]
|
53 |
REQUIREMENTS_LABEL = ["📋 Requirements", "📋 Зависимости"]
|
54 |
-
PRACTICAL_TASKS_LABEL = "Practical tasks"
|
55 |
-
PRACTICAL_SUBTASKS_LABEL = "Practical subtasks"
|
56 |
THRESHOLD_MBTI_LABEL = "Polarity traits threshold"
|
57 |
THRESHOLD_PROFESSIONAL_SKILLS_LABEL = "Polarity traits threshold"
|
58 |
TARGET_SCORE_OPE_LABEL = "Openness target score"
|
@@ -61,6 +72,7 @@ TARGET_SCORE_EXT_LABEL = "Extraversion target score"
|
|
61 |
TARGET_SCORE_AGR_LABEL = "Agreeableness target score"
|
62 |
TARGET_SCORE_NNEU_LABEL = "Non-Neuroticism target score"
|
63 |
EQUAL_COEFFICIENT_LABEL = "Equal coefficient"
|
|
|
64 |
NUMBER_PRIORITY_LABEL = "Priority number"
|
65 |
NUMBER_IMPORTANCE_TRAITS_LABEL = "Importance traits number"
|
66 |
NUMBER_IMPORTANCE_OPE_LABEL = "Openness weight"
|
@@ -138,8 +150,10 @@ DROPDOWN_MBTI = [
|
|
138 |
"The Commander (ENTJ): Construction Supervisor, Health Services Administrator, Financial Accountant, Auditor, Lawyer, School Principal, Chemical Engineer, Database Manager, etc.",
|
139 |
]
|
140 |
DROPDOWN_MBTI_DEL_COLS = ["EI", "SN", "TF", "JP", "Match"]
|
|
|
141 |
SHOW_VIDEO_METADATA = true
|
142 |
SUPPORTED_VIDEO_EXT = ["mp4", "mov", "avi", "flv"]
|
|
|
143 |
|
144 |
[Values]
|
145 |
TARGET_SCORES = [0.527886, 0.522337, 0.458468, 0.51761, 0.444649]
|
|
|
1 |
[AppSettings]
|
2 |
+
APP_VERSION = "0.11.0"
|
3 |
+
SERVER_NAME = "127.0.0.1"
|
4 |
+
PORT = 7860
|
5 |
CSS_PATH = "app.css"
|
6 |
DEFAULT_LANG_ID = 0
|
7 |
|
|
|
11 |
"- библиотека с открытым исходным кодом для оценивания большой пятерки качеств личности человека и автоматизации HR-процессов",
|
12 |
]
|
13 |
NOTI_VIDEOS = ["Select the video(s)", "Выберите видео"]
|
14 |
+
PRACTICAL_TASKS_INFO = ["Choose a practical task", "Выберите практическую задачу"]
|
15 |
+
PRACTICAL_SUBTASKS_INFO = ["Choose a practical subtask", "Выберите практическую подзадачу"]
|
16 |
NOTI_IN_DEV = "In development"
|
17 |
DROPDOWN_MBTI_INFO = "What personality type indicator are you interested in?"
|
18 |
DROPDOWN_PROFESSIONAL_SKILLS_INFO = "What professional skill are you interested in?"
|
|
|
33 |
[OtherMessages]
|
34 |
VIDEO_FILES = ["Video Files", "Видеофайлы"]
|
35 |
VIDEO_PLAYER = ["Video Player", "Видео проигрыватель"]
|
36 |
+
CALCULATE_PT_SCORES = [
|
37 |
+
"Calculation of Big Five personality traits scores",
|
38 |
+
"Вычисление показателей Большой пятерки персональных качеств личности человека"
|
39 |
+
]
|
40 |
+
CALCULATE_PT_SCORES_ERR = [
|
41 |
+
"Personality traits scores have not been calculated. Ensure that there are uncovered face and speech of person in the video",
|
42 |
+
"Оценки персональных качеств личностей человека не были вычислены. Убедитесь, что в видео присутствует не перекрытое лицо и речь человека"
|
43 |
+
]
|
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]
|
61 |
APP_LABEL = ["⭐ App", "⭐ Приложение"]
|
62 |
ABOUT_APP_LABEL = ["💡 About the App", "💡 О приложении"]
|
63 |
ABOUT_AUTHORS_LABEL = ["🎭 About the Authors", "🎭 Об авторах"]
|
64 |
REQUIREMENTS_LABEL = ["📋 Requirements", "📋 Зависимости"]
|
65 |
+
PRACTICAL_TASKS_LABEL = ["Practical tasks", "Практические задачи"]
|
66 |
+
PRACTICAL_SUBTASKS_LABEL = ["Practical subtasks", "Практические подзадачи"]
|
67 |
THRESHOLD_MBTI_LABEL = "Polarity traits threshold"
|
68 |
THRESHOLD_PROFESSIONAL_SKILLS_LABEL = "Polarity traits threshold"
|
69 |
TARGET_SCORE_OPE_LABEL = "Openness target score"
|
|
|
72 |
TARGET_SCORE_AGR_LABEL = "Agreeableness target score"
|
73 |
TARGET_SCORE_NNEU_LABEL = "Non-Neuroticism target score"
|
74 |
EQUAL_COEFFICIENT_LABEL = "Equal coefficient"
|
75 |
+
THRESHOLD_TARGET_SCORE_LABEL = "Polarity traits threshold"
|
76 |
NUMBER_PRIORITY_LABEL = "Priority number"
|
77 |
NUMBER_IMPORTANCE_TRAITS_LABEL = "Importance traits number"
|
78 |
NUMBER_IMPORTANCE_OPE_LABEL = "Openness weight"
|
|
|
150 |
"The Commander (ENTJ): Construction Supervisor, Health Services Administrator, Financial Accountant, Auditor, Lawyer, School Principal, Chemical Engineer, Database Manager, etc.",
|
151 |
]
|
152 |
DROPDOWN_MBTI_DEL_COLS = ["EI", "SN", "TF", "JP", "Match"]
|
153 |
+
DROPDOWN_MBTI_DEL_COLS_WEBCAM = ["Path"]
|
154 |
SHOW_VIDEO_METADATA = true
|
155 |
SUPPORTED_VIDEO_EXT = ["mp4", "mov", "avi", "flv"]
|
156 |
+
TYPE_MODES = ["Files", "Web"]
|
157 |
|
158 |
[Values]
|
159 |
TARGET_SCORES = [0.527886, 0.522337, 0.458468, 0.51761, 0.444649]
|
images/videos.ico
ADDED
images/webcam.ico
ADDED
practical_tasks.yaml → practical_tasks_en.yaml
RENAMED
@@ -7,8 +7,9 @@
|
|
7 |
subtasks:
|
8 |
- "Finding a suitable junior colleague"
|
9 |
- "Finding a suitable senior colleague"
|
|
|
10 |
- task: "Predicting consumer preferences for industrial goods"
|
11 |
subtasks:
|
12 |
- "Car characteristics"
|
13 |
- "Mobile device application categories"
|
14 |
-
- "Clothing
|
|
|
7 |
subtasks:
|
8 |
- "Finding a suitable junior colleague"
|
9 |
- "Finding a suitable senior colleague"
|
10 |
+
- "Finding a suitable colleague by personality types"
|
11 |
- task: "Predicting consumer preferences for industrial goods"
|
12 |
subtasks:
|
13 |
- "Car characteristics"
|
14 |
- "Mobile device application categories"
|
15 |
+
- "Clothing styles"
|
practical_tasks_ru.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- task: "Ранжирование потенциальных кандидатов по профессиональным обязанностям"
|
2 |
+
subtasks:
|
3 |
+
- "16 персональных типов личности MBTI"
|
4 |
+
- "Профессиональные группы"
|
5 |
+
- "Профессиональные навыки"
|
6 |
+
- task: "Формирование эффективных рабочих коллективов"
|
7 |
+
subtasks:
|
8 |
+
- "Поиск подходящего младшего коллеги"
|
9 |
+
- "Поиск подходящего старшего коллеги"
|
10 |
+
- "Поиск подходящего коллеги по типам личности"
|
11 |
+
- task: "Прогнозирование потребительских предпочтений в отношении промышленных товаров"
|
12 |
+
subtasks:
|
13 |
+
- "Характеристики автомобиля"
|
14 |
+
- "Категории приложений для мобильных устройств"
|
15 |
+
- "Стиль одежды"
|
requirements.txt
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
-
gradio==5.
|
2 |
-
PyYAML==6.0.
|
3 |
toml==0.10.2
|
4 |
-
oceanai==1.0.
|
5 |
-
|
|
|
|
|
|
1 |
+
gradio==5.8.0
|
2 |
+
PyYAML==6.0.2
|
3 |
toml==0.10.2
|
4 |
+
oceanai==1.0.0a46
|
5 |
+
torch==2.2.2
|
6 |
+
psutil==6.1.0
|
7 |
+
beautifulsoup4==4.12.3
|