Spaces:
Running
Running
v0.9.2 (#21)
Browse files- Summary (096ab960a7b3d1c3a70df90cadf556317f1a043c)
Co-authored-by: Dmitry Ryumin <[email protected]>
- app/event_handlers/calculate_practical_tasks.py +10 -8
- app/event_handlers/calculate_pt_scores_blocks.py +4 -10
- app/event_handlers/clear_blocks.py +1 -1
- app/event_handlers/event_handlers.py +4 -1
- app/event_handlers/languages.py +29 -2
- app/event_handlers/practical_task_sorted.py +10 -2
- app/tabs.py +3 -1
- config.toml +15 -2
app/event_handlers/calculate_practical_tasks.py
CHANGED
|
@@ -193,7 +193,7 @@ def event_handler_calculate_practical_task_blocks(
|
|
| 193 |
|
| 194 |
pt_scores_copy = pt_scores.iloc[:, 1:].copy()
|
| 195 |
|
| 196 |
-
preprocess_scores_df(pt_scores_copy,
|
| 197 |
|
| 198 |
b5._professional_match(
|
| 199 |
df_files=pt_scores_copy,
|
|
@@ -223,7 +223,7 @@ def event_handler_calculate_practical_task_blocks(
|
|
| 223 |
|
| 224 |
df_hidden.reset_index(inplace=True)
|
| 225 |
|
| 226 |
-
person_id = int(df_hidden.iloc[0][
|
| 227 |
|
| 228 |
short_mbti = extract_text_in_parentheses(dropdown_mbti)
|
| 229 |
mbti_values = df_hidden["Personality Type"].tolist()
|
|
@@ -349,7 +349,9 @@ def event_handler_calculate_practical_task_blocks(
|
|
| 349 |
|
| 350 |
df_hidden.reset_index(inplace=True)
|
| 351 |
|
| 352 |
-
person_id =
|
|
|
|
|
|
|
| 353 |
|
| 354 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
| 355 |
|
|
@@ -417,7 +419,7 @@ def event_handler_calculate_practical_task_blocks(
|
|
| 417 |
by=[dropdown_professional_skills], ascending=False
|
| 418 |
)
|
| 419 |
|
| 420 |
-
person_id = int(df_hidden.iloc[0][
|
| 421 |
|
| 422 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
| 423 |
|
|
@@ -487,7 +489,7 @@ def event_handler_calculate_practical_task_blocks(
|
|
| 487 |
|
| 488 |
df_hidden.reset_index(inplace=True)
|
| 489 |
|
| 490 |
-
person_id = int(df_hidden.iloc[0][
|
| 491 |
|
| 492 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
| 493 |
|
|
@@ -544,7 +546,7 @@ def event_handler_calculate_practical_task_blocks(
|
|
| 544 |
|
| 545 |
pt_scores_copy = pt_scores.iloc[:, 1:].copy()
|
| 546 |
|
| 547 |
-
preprocess_scores_df(pt_scores_copy,
|
| 548 |
|
| 549 |
b5._priority_calculation(
|
| 550 |
df_files=pt_scores_copy,
|
|
@@ -561,7 +563,7 @@ def event_handler_calculate_practical_task_blocks(
|
|
| 561 |
|
| 562 |
df = apply_rounding_and_rename_columns(df_files_priority.iloc[:, 1:])
|
| 563 |
|
| 564 |
-
preprocess_scores_df(df,
|
| 565 |
|
| 566 |
df_hidden = df.drop(columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS)
|
| 567 |
|
|
@@ -569,7 +571,7 @@ def event_handler_calculate_practical_task_blocks(
|
|
| 569 |
|
| 570 |
df_hidden.reset_index(inplace=True)
|
| 571 |
|
| 572 |
-
person_id = int(df_hidden.iloc[0][
|
| 573 |
|
| 574 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
| 575 |
|
|
|
|
| 193 |
|
| 194 |
pt_scores_copy = pt_scores.iloc[:, 1:].copy()
|
| 195 |
|
| 196 |
+
preprocess_scores_df(pt_scores_copy, config_data.Dataframes_PT_SCORES[0][0])
|
| 197 |
|
| 198 |
b5._professional_match(
|
| 199 |
df_files=pt_scores_copy,
|
|
|
|
| 223 |
|
| 224 |
df_hidden.reset_index(inplace=True)
|
| 225 |
|
| 226 |
+
person_id = int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
| 227 |
|
| 228 |
short_mbti = extract_text_in_parentheses(dropdown_mbti)
|
| 229 |
mbti_values = df_hidden["Personality Type"].tolist()
|
|
|
|
| 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 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
| 357 |
|
|
|
|
| 419 |
by=[dropdown_professional_skills], ascending=False
|
| 420 |
)
|
| 421 |
|
| 422 |
+
person_id = int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
| 423 |
|
| 424 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
| 425 |
|
|
|
|
| 489 |
|
| 490 |
df_hidden.reset_index(inplace=True)
|
| 491 |
|
| 492 |
+
person_id = int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
| 493 |
|
| 494 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
| 495 |
|
|
|
|
| 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])
|
| 550 |
|
| 551 |
b5._priority_calculation(
|
| 552 |
df_files=pt_scores_copy,
|
|
|
|
| 563 |
|
| 564 |
df = apply_rounding_and_rename_columns(df_files_priority.iloc[:, 1:])
|
| 565 |
|
| 566 |
+
preprocess_scores_df(df, config_data.Dataframes_PT_SCORES[0][0])
|
| 567 |
|
| 568 |
df_hidden = df.drop(columns=config_data.Settings_SHORT_PROFESSIONAL_SKILLS)
|
| 569 |
|
|
|
|
| 571 |
|
| 572 |
df_hidden.reset_index(inplace=True)
|
| 573 |
|
| 574 |
+
person_id = int(df_hidden.iloc[0][config_data.Dataframes_PT_SCORES[0][0]]) - 1
|
| 575 |
|
| 576 |
person_metadata = create_person_metadata(person_id, files, video_metadata)
|
| 577 |
|
app/event_handlers/calculate_pt_scores_blocks.py
CHANGED
|
@@ -11,7 +11,7 @@ import gradio as gr
|
|
| 11 |
from app.oceanai_init import b5
|
| 12 |
from app.config import config_data
|
| 13 |
from app.description_steps import STEP_2
|
| 14 |
-
from app.utils import
|
| 15 |
from app.practical_tasks import supported_practical_tasks
|
| 16 |
from app.components import (
|
| 17 |
html_message,
|
|
@@ -48,7 +48,7 @@ def event_handler_calculate_pt_scores_blocks(language, files, evt_data: gr.Event
|
|
| 48 |
None,
|
| 49 |
"single",
|
| 50 |
[".csv"],
|
| 51 |
-
config_data.OtherMessages_EXPORT_PT_SCORES,
|
| 52 |
True,
|
| 53 |
False,
|
| 54 |
False,
|
|
@@ -149,18 +149,12 @@ 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 |
-
df_traits_priority_for_professions = read_csv_file(config_data.Links_PROFESSIONS)
|
| 153 |
-
weights_professions, interactive_professions = extract_profession_weights(
|
| 154 |
-
df_traits_priority_for_professions,
|
| 155 |
-
config_data.Settings_DROPDOWN_CANDIDATES[0],
|
| 156 |
-
)
|
| 157 |
-
|
| 158 |
return (
|
| 159 |
html_message(
|
| 160 |
config_data.InformationMessages_NOTI_VIDEOS[lang_id], False, False
|
| 161 |
),
|
| 162 |
dataframe(
|
| 163 |
-
headers=
|
| 164 |
values=df_files.values.tolist(),
|
| 165 |
visible=True,
|
| 166 |
),
|
|
@@ -168,7 +162,7 @@ def event_handler_calculate_pt_scores_blocks(language, files, evt_data: gr.Event
|
|
| 168 |
config_data.Filenames_PT_SCORES,
|
| 169 |
"single",
|
| 170 |
[".csv"],
|
| 171 |
-
config_data.OtherMessages_EXPORT_PT_SCORES,
|
| 172 |
True,
|
| 173 |
False,
|
| 174 |
True,
|
|
|
|
| 11 |
from app.oceanai_init import b5
|
| 12 |
from app.config import config_data
|
| 13 |
from app.description_steps import STEP_2
|
| 14 |
+
from app.utils import get_language_settings
|
| 15 |
from app.practical_tasks import supported_practical_tasks
|
| 16 |
from app.components import (
|
| 17 |
html_message,
|
|
|
|
| 48 |
None,
|
| 49 |
"single",
|
| 50 |
[".csv"],
|
| 51 |
+
config_data.OtherMessages_EXPORT_PT_SCORES[lang_id],
|
| 52 |
True,
|
| 53 |
False,
|
| 54 |
False,
|
|
|
|
| 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], False, False
|
| 155 |
),
|
| 156 |
dataframe(
|
| 157 |
+
headers=(config_data.Dataframes_PT_SCORES[lang_id]),
|
| 158 |
values=df_files.values.tolist(),
|
| 159 |
visible=True,
|
| 160 |
),
|
|
|
|
| 162 |
config_data.Filenames_PT_SCORES,
|
| 163 |
"single",
|
| 164 |
[".csv"],
|
| 165 |
+
config_data.OtherMessages_EXPORT_PT_SCORES[lang_id],
|
| 166 |
True,
|
| 167 |
False,
|
| 168 |
True,
|
app/event_handlers/clear_blocks.py
CHANGED
|
@@ -61,7 +61,7 @@ def event_handler_clear_blocks(language):
|
|
| 61 |
None,
|
| 62 |
"single",
|
| 63 |
[".csv"],
|
| 64 |
-
config_data.OtherMessages_EXPORT_PT_SCORES,
|
| 65 |
True,
|
| 66 |
False,
|
| 67 |
False,
|
|
|
|
| 61 |
None,
|
| 62 |
"single",
|
| 63 |
[".csv"],
|
| 64 |
+
config_data.OtherMessages_EXPORT_PT_SCORES[lang_id],
|
| 65 |
True,
|
| 66 |
False,
|
| 67 |
False,
|
app/event_handlers/event_handlers.py
CHANGED
|
@@ -101,7 +101,7 @@ def setup_app_event_handlers(
|
|
| 101 |
# Events
|
| 102 |
languages.select(
|
| 103 |
fn=event_handler_languages,
|
| 104 |
-
inputs=[languages, files, video, pt_scores],
|
| 105 |
outputs=[
|
| 106 |
description,
|
| 107 |
step_1,
|
|
@@ -117,6 +117,9 @@ def setup_app_event_handlers(
|
|
| 117 |
calculate_pt_scores,
|
| 118 |
clear_app,
|
| 119 |
notifications,
|
|
|
|
|
|
|
|
|
|
| 120 |
],
|
| 121 |
queue=True,
|
| 122 |
)
|
|
|
|
| 101 |
# Events
|
| 102 |
languages.select(
|
| 103 |
fn=event_handler_languages,
|
| 104 |
+
inputs=[languages, files, video, pt_scores, csv_pt_scores],
|
| 105 |
outputs=[
|
| 106 |
description,
|
| 107 |
step_1,
|
|
|
|
| 117 |
calculate_pt_scores,
|
| 118 |
clear_app,
|
| 119 |
notifications,
|
| 120 |
+
pt_scores,
|
| 121 |
+
csv_pt_scores,
|
| 122 |
+
step_2,
|
| 123 |
],
|
| 124 |
queue=True,
|
| 125 |
)
|
app/event_handlers/languages.py
CHANGED
|
@@ -10,7 +10,7 @@ from pathlib import Path
|
|
| 10 |
|
| 11 |
# Importing necessary components for the Gradio app
|
| 12 |
from app.description import DESCRIPTIONS
|
| 13 |
-
from app.description_steps import STEP_1
|
| 14 |
from app.config import config_data
|
| 15 |
from app.components import (
|
| 16 |
files_create_ui,
|
|
@@ -18,11 +18,12 @@ from app.components import (
|
|
| 18 |
dropdown_create_ui,
|
| 19 |
button,
|
| 20 |
html_message,
|
|
|
|
| 21 |
)
|
| 22 |
from app.utils import get_language_settings
|
| 23 |
|
| 24 |
|
| 25 |
-
def event_handler_languages(languages, files, video, pt_scores):
|
| 26 |
lang_id, choices = get_language_settings(languages)
|
| 27 |
|
| 28 |
if not video:
|
|
@@ -42,6 +43,29 @@ def event_handler_languages(languages, files, video, pt_scores):
|
|
| 42 |
False if pt_scores.shape[1] >= 7 else True,
|
| 43 |
)
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
return (
|
| 46 |
gr.Markdown(value=DESCRIPTIONS[lang_id]),
|
| 47 |
gr.HTML(value=STEP_1[lang_id]),
|
|
@@ -95,4 +119,7 @@ def event_handler_languages(languages, files, video, pt_scores):
|
|
| 95 |
"clear_oceanai",
|
| 96 |
),
|
| 97 |
noti_videos,
|
|
|
|
|
|
|
|
|
|
| 98 |
)
|
|
|
|
| 10 |
|
| 11 |
# Importing necessary components for the Gradio app
|
| 12 |
from app.description import DESCRIPTIONS
|
| 13 |
+
from app.description_steps import STEP_1, STEP_2
|
| 14 |
from app.config import config_data
|
| 15 |
from app.components import (
|
| 16 |
files_create_ui,
|
|
|
|
| 18 |
dropdown_create_ui,
|
| 19 |
button,
|
| 20 |
html_message,
|
| 21 |
+
dataframe,
|
| 22 |
)
|
| 23 |
from app.utils import get_language_settings
|
| 24 |
|
| 25 |
|
| 26 |
+
def event_handler_languages(languages, files, video, pt_scores, csv_pt_scores):
|
| 27 |
lang_id, choices = get_language_settings(languages)
|
| 28 |
|
| 29 |
if not video:
|
|
|
|
| 43 |
False if pt_scores.shape[1] >= 7 else True,
|
| 44 |
)
|
| 45 |
|
| 46 |
+
csv_pt_scores = files_create_ui(
|
| 47 |
+
csv_pt_scores if pt_scores.shape[1] >= 7 else None,
|
| 48 |
+
"single",
|
| 49 |
+
[".csv"],
|
| 50 |
+
config_data.OtherMessages_EXPORT_PT_SCORES[lang_id],
|
| 51 |
+
True,
|
| 52 |
+
False,
|
| 53 |
+
True if pt_scores.shape[1] >= 7 else False,
|
| 54 |
+
"csv-container",
|
| 55 |
+
)
|
| 56 |
+
step_2 = gr.HTML(
|
| 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]),
|
| 63 |
+
values=pt_scores.values.tolist(),
|
| 64 |
+
visible=True,
|
| 65 |
+
)
|
| 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]),
|
|
|
|
| 119 |
"clear_oceanai",
|
| 120 |
),
|
| 121 |
noti_videos,
|
| 122 |
+
pt_scores,
|
| 123 |
+
csv_pt_scores,
|
| 124 |
+
step_2,
|
| 125 |
)
|
app/event_handlers/practical_task_sorted.py
CHANGED
|
@@ -9,6 +9,7 @@ import gradio as gr
|
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
# Importing necessary components for the Gradio app
|
|
|
|
| 12 |
from app.video_metadata import video_metadata
|
| 13 |
from app.components import video_create_ui, textbox_create_ui
|
| 14 |
|
|
@@ -16,13 +17,20 @@ from app.components import video_create_ui, textbox_create_ui
|
|
| 16 |
def event_handler_practical_task_sorted(
|
| 17 |
files, practical_task_sorted, evt_data: gr.SelectData
|
| 18 |
):
|
| 19 |
-
person_id =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
if evt_data.index[0] == 0:
|
| 22 |
label = "Best"
|
| 23 |
else:
|
| 24 |
label = ""
|
| 25 |
-
label += "
|
| 26 |
|
| 27 |
if Path(files[person_id]).name in video_metadata:
|
| 28 |
person_metadata_list = video_metadata[Path(files[person_id]).name]
|
|
|
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
# Importing necessary components for the Gradio app
|
| 12 |
+
from app.config import config_data
|
| 13 |
from app.video_metadata import video_metadata
|
| 14 |
from app.components import video_create_ui, textbox_create_ui
|
| 15 |
|
|
|
|
| 17 |
def event_handler_practical_task_sorted(
|
| 18 |
files, practical_task_sorted, evt_data: gr.SelectData
|
| 19 |
):
|
| 20 |
+
person_id = (
|
| 21 |
+
int(
|
| 22 |
+
practical_task_sorted.iloc[evt_data.index[0]][
|
| 23 |
+
config_data.Dataframes_PT_SCORES[0][0]
|
| 24 |
+
]
|
| 25 |
+
)
|
| 26 |
+
- 1
|
| 27 |
+
)
|
| 28 |
|
| 29 |
if evt_data.index[0] == 0:
|
| 30 |
label = "Best"
|
| 31 |
else:
|
| 32 |
label = ""
|
| 33 |
+
label += " " + config_data.Dataframes_PT_SCORES[0][0]
|
| 34 |
|
| 35 |
if Path(files[person_id]).name in video_metadata:
|
| 36 |
person_metadata_list = video_metadata[Path(files[person_id]).name]
|
app/tabs.py
CHANGED
|
@@ -95,7 +95,9 @@ def app_tab():
|
|
| 95 |
None,
|
| 96 |
"single",
|
| 97 |
[".csv"],
|
| 98 |
-
config_data.OtherMessages_EXPORT_PT_SCORES
|
|
|
|
|
|
|
| 99 |
True,
|
| 100 |
False,
|
| 101 |
False,
|
|
|
|
| 95 |
None,
|
| 96 |
"single",
|
| 97 |
[".csv"],
|
| 98 |
+
config_data.OtherMessages_EXPORT_PT_SCORES[
|
| 99 |
+
config_data.AppSettings_DEFAULT_LANG_ID
|
| 100 |
+
],
|
| 101 |
True,
|
| 102 |
False,
|
| 103 |
False,
|
config.toml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
[AppSettings]
|
| 2 |
-
APP_VERSION = "0.9.
|
| 3 |
CSS_PATH = "app.css"
|
| 4 |
DEFAULT_LANG_ID = 0
|
| 5 |
|
|
@@ -36,7 +36,9 @@ CALCULATE_PT_SCORES_ERR = "Personality traits scores have not been calculated. T
|
|
| 36 |
CALCULATE_PRACTICAL_TASK = "Solving practical task"
|
| 37 |
CLEAR_APP = ["Clear", "Сброс"]
|
| 38 |
EXAMPLES_APP = ["Examples", "Примеры"]
|
| 39 |
-
EXPORT_PT_SCORES =
|
|
|
|
|
|
|
| 40 |
EXPORT_PG = "Export ranking professional groups results to a CSV file"
|
| 41 |
EXPORT_PS = "Export ranking professional skill results to a CSV file"
|
| 42 |
EXPORT_WT = "Export ranking effective work teams results to a CSV file"
|
|
@@ -86,6 +88,17 @@ MDA_CATEGORIES = "divice_characteristics_priorities.csv"
|
|
| 86 |
POTENTIAL_CANDIDATES = "potential_candidates.csv"
|
| 87 |
MBTI_JOB = "mbti_job_match.csv"
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
[Images]
|
| 90 |
LANGUAGES = ["UK.png", "RU.png"]
|
| 91 |
|
|
|
|
| 1 |
[AppSettings]
|
| 2 |
+
APP_VERSION = "0.9.2"
|
| 3 |
CSS_PATH = "app.css"
|
| 4 |
DEFAULT_LANG_ID = 0
|
| 5 |
|
|
|
|
| 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 файл"]
|
| 42 |
EXPORT_PG = "Export ranking professional groups results to a CSV file"
|
| 43 |
EXPORT_PS = "Export ranking professional skill results to a CSV file"
|
| 44 |
EXPORT_WT = "Export ranking effective work teams results to a CSV file"
|
|
|
|
| 88 |
POTENTIAL_CANDIDATES = "potential_candidates.csv"
|
| 89 |
MBTI_JOB = "mbti_job_match.csv"
|
| 90 |
|
| 91 |
+
[Dataframes]
|
| 92 |
+
PT_SCORES = [
|
| 93 |
+
[
|
| 94 |
+
"Person ID", "Path", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Non-Neuroticism"
|
| 95 |
+
],
|
| 96 |
+
[
|
| 97 |
+
"Идентификатор", "Имя файла",
|
| 98 |
+
"Открытость к опыту", "Добросовестность", "Экстроверсия", "Доброжелательность", "Эмоциональная стабильность"
|
| 99 |
+
]
|
| 100 |
+
]
|
| 101 |
+
|
| 102 |
[Images]
|
| 103 |
LANGUAGES = ["UK.png", "RU.png"]
|
| 104 |
|