ElenaRyumina DmitryRyumin commited on
Commit
aa6222e
1 Parent(s): bb45169

- Summary (2d3271b2c465f4c15cf5b60cc69be097f4220d6d)


Co-authored-by: Dmitry Ryumin <[email protected]>

app.css CHANGED
@@ -5,6 +5,10 @@
5
  color: #006900;
6
  }
7
 
 
 
 
 
8
  div.app-flex-container {
9
  display: flex;
10
  gap: 6px;
@@ -132,6 +136,7 @@ div.languages-container_wrapper {
132
  width: auto;
133
  position: absolute;
134
  right: 0px;
 
135
  }
136
 
137
  div.languages-container {
 
5
  color: #006900;
6
  }
7
 
8
+ h1 > a {
9
+ display: contents;
10
+ }
11
+
12
  div.app-flex-container {
13
  display: flex;
14
  gap: 6px;
 
136
  width: auto;
137
  position: absolute;
138
  right: 0px;
139
+ z-index: 10;
140
  }
141
 
142
  div.languages-container {
app.py CHANGED
@@ -13,7 +13,7 @@ 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=["images/"])
17
 
18
 
19
  def create_gradio_app() -> gr.Blocks:
@@ -31,7 +31,8 @@ def create_gradio_app() -> gr.Blocks:
31
  elem_classes="languages-container",
32
  ) as languages_row:
33
  country_flags = gr.Image(
34
- value="images/UK.png",
 
35
  container=False,
36
  interactive=False,
37
  show_label=False,
@@ -48,7 +49,7 @@ def create_gradio_app() -> gr.Blocks:
48
  visible=True,
49
  show_label=False,
50
  elem_classes="dropdown-language-container",
51
- interactive=False,
52
  )
53
 
54
  tab_results = {}
 
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:
 
31
  elem_classes="languages-container",
32
  ) as languages_row:
33
  country_flags = gr.Image(
34
+ value=config_data.StaticPaths_IMAGES
35
+ + config_data.Images_LANGUAGES[0],
36
  container=False,
37
  interactive=False,
38
  show_label=False,
 
49
  visible=True,
50
  show_label=False,
51
  elem_classes="dropdown-language-container",
52
+ interactive=True,
53
  )
54
 
55
  tab_results = {}
app/description.py CHANGED
@@ -8,11 +8,24 @@ License: MIT License
8
  # Importing necessary components for the Gradio app
9
  from app.config import config_data
10
 
11
- DESCRIPTION = f"""\
12
- <h1><a href="https://github.com/aimclub/OCEANAI" target="_blank">OCEAN-AI</a> is an open-source framework for Big Five personality traits assessment and HR-processes automatization.</h1>
13
 
14
  <div class="app-flex-container">
15
- <img src="https://img.shields.io/badge/version-v{config_data.AppSettings_APP_VERSION}-rc0" alt="Version">
16
  <a href='https://github.com/DmitryRyumin/OCEANAI' target='_blank'><img src='https://img.shields.io/github/stars/DmitryRyumin/OCEANAI?style=flat' alt='GitHub' /></a>
17
  </div>
18
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  # Importing necessary components for the Gradio app
9
  from app.config import config_data
10
 
11
+ TEMPLATE = """\
12
+ <h1><a href="https://github.com/aimclub/OCEANAI" target="_blank">OCEAN-AI</a> {description}.</h1>
13
 
14
  <div class="app-flex-container">
15
+ <img src="https://img.shields.io/badge/version-v{version}-rc0" alt="{version_label}">
16
  <a href='https://github.com/DmitryRyumin/OCEANAI' target='_blank'><img src='https://img.shields.io/github/stars/DmitryRyumin/OCEANAI?style=flat' alt='GitHub' /></a>
17
  </div>
18
  """
19
+
20
+ DESCRIPTIONS = [
21
+ TEMPLATE.format(
22
+ description=config_data.InformationMessages_DESCRIPTIONS[0],
23
+ version=config_data.AppSettings_APP_VERSION,
24
+ version_label="Version",
25
+ ),
26
+ TEMPLATE.format(
27
+ description=config_data.InformationMessages_DESCRIPTIONS[1],
28
+ version=config_data.AppSettings_APP_VERSION,
29
+ version_label="Версия",
30
+ ),
31
+ ]
app/description_steps.py CHANGED
@@ -8,10 +8,24 @@ License: MIT License
8
  # Importing necessary components for the Gradio app
9
  from app.config import config_data
10
 
11
- STEP_1 = f"""\
12
- <h2 align="center">{config_data.InformationMessages_STEP_1}</h2>
13
  """
14
 
15
- STEP_2 = f"""\
16
- <h2 align="center">{config_data.InformationMessages_STEP_2}</h2>
17
- """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  # Importing necessary components for the Gradio app
9
  from app.config import config_data
10
 
11
+ STEPS_TEMPLATE = """\
12
+ <h2 align="center">{text}</h2>
13
  """
14
 
15
+ STEP_1 = [
16
+ STEPS_TEMPLATE.format(
17
+ text=config_data.InformationMessages_STEP_1[0],
18
+ ),
19
+ STEPS_TEMPLATE.format(
20
+ text=config_data.InformationMessages_STEP_1[1],
21
+ ),
22
+ ]
23
+
24
+ STEP_2 = [
25
+ STEPS_TEMPLATE.format(
26
+ text=config_data.InformationMessages_STEP_2[0],
27
+ ),
28
+ STEPS_TEMPLATE.format(
29
+ text=config_data.InformationMessages_STEP_2[1],
30
+ ),
31
+ ]
app/event_handlers/event_handlers.py CHANGED
@@ -28,6 +28,8 @@ from app.event_handlers.practical_task_sorted import event_handler_practical_tas
28
 
29
 
30
  def setup_app_event_handlers(
 
 
31
  notifications,
32
  files,
33
  video,
@@ -98,8 +100,18 @@ def setup_app_event_handlers(
98
  # Events
99
  languages.select(
100
  fn=event_handler_languages,
101
- inputs=[languages],
102
- outputs=[languages, tab1, tab2, tab3],
 
 
 
 
 
 
 
 
 
 
103
  queue=True,
104
  )
105
  files.change(
 
28
 
29
 
30
  def setup_app_event_handlers(
31
+ description,
32
+ step_1,
33
  notifications,
34
  files,
35
  video,
 
100
  # Events
101
  languages.select(
102
  fn=event_handler_languages,
103
+ inputs=[languages, files],
104
+ outputs=[
105
+ description,
106
+ step_1,
107
+ country_flags,
108
+ languages,
109
+ tab1,
110
+ tab2,
111
+ tab3,
112
+ tab4,
113
+ files,
114
+ ],
115
  queue=True,
116
  )
117
  files.change(
app/event_handlers/languages.py CHANGED
@@ -8,11 +8,16 @@ License: MIT License
8
  import gradio as gr
9
 
10
  # Importing necessary components for the Gradio app
 
 
11
  from app.config import config_data
12
- from app.components import dropdown_create_ui
 
 
 
13
 
14
 
15
- def event_handler_languages(languages):
16
  if languages.lower() == "english":
17
  lang_id = 0
18
  choices = config_data.Settings_LANGUAGES_EN
@@ -24,6 +29,11 @@ def event_handler_languages(languages):
24
  choices = config_data.Settings_LANGUAGES_EN
25
 
26
  return (
 
 
 
 
 
27
  dropdown_create_ui(
28
  label=None,
29
  info=None,
@@ -36,4 +46,13 @@ def event_handler_languages(languages):
36
  gr.Tab(config_data.Labels_APP_LABEL[lang_id]),
37
  gr.Tab(config_data.Labels_ABOUT_APP_LABEL[lang_id]),
38
  gr.Tab(config_data.Labels_ABOUT_AUTHORS_LABEL[lang_id]),
 
 
 
 
 
 
 
 
 
39
  )
 
8
  import gradio as gr
9
 
10
  # Importing necessary components for the Gradio app
11
+ from app.description import DESCRIPTIONS
12
+ from app.description_steps import STEP_1
13
  from app.config import config_data
14
+ from app.components import (
15
+ files_create_ui,
16
+ dropdown_create_ui,
17
+ )
18
 
19
 
20
+ def event_handler_languages(languages, files):
21
  if languages.lower() == "english":
22
  lang_id = 0
23
  choices = config_data.Settings_LANGUAGES_EN
 
29
  choices = config_data.Settings_LANGUAGES_EN
30
 
31
  return (
32
+ gr.Markdown(value=DESCRIPTIONS[lang_id]),
33
+ gr.HTML(value=STEP_1[lang_id]),
34
+ gr.Image(
35
+ value=config_data.StaticPaths_IMAGES + config_data.Images_LANGUAGES[lang_id]
36
+ ),
37
  dropdown_create_ui(
38
  label=None,
39
  info=None,
 
46
  gr.Tab(config_data.Labels_APP_LABEL[lang_id]),
47
  gr.Tab(config_data.Labels_ABOUT_APP_LABEL[lang_id]),
48
  gr.Tab(config_data.Labels_ABOUT_AUTHORS_LABEL[lang_id]),
49
+ gr.Tab(config_data.Labels_REQUIREMENTS_LABEL[lang_id]),
50
+ files_create_ui(
51
+ value=files,
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
+ ),
58
  )
app/tabs.py CHANGED
@@ -8,7 +8,7 @@ License: MIT License
8
  import gradio as gr
9
 
10
  # Importing necessary components for the Gradio app
11
- from app.description import DESCRIPTION
12
  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
@@ -31,14 +31,18 @@ from app.components import (
31
 
32
 
33
  def app_tab():
34
- gr.Markdown(value=DESCRIPTION)
 
 
35
 
36
- gr.HTML(value=STEP_1)
37
 
38
  with gr.Row():
39
  files = files_create_ui(
40
  label="{} ({})".format(
41
- config_data.OtherMessages_VIDEO_FILES,
 
 
42
  ", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
43
  ),
44
  file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
@@ -588,6 +592,8 @@ def app_tab():
588
  )
589
 
590
  return (
 
 
591
  notifications,
592
  files,
593
  video,
 
8
  import gradio as gr
9
 
10
  # Importing necessary components for the Gradio app
11
+ from app.description import DESCRIPTIONS
12
  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
 
31
 
32
 
33
  def app_tab():
34
+ description = gr.Markdown(
35
+ value=DESCRIPTIONS[config_data.AppSettings_DEFAULT_LANG_ID]
36
+ )
37
 
38
+ step_1 = gr.HTML(value=STEP_1[config_data.AppSettings_DEFAULT_LANG_ID])
39
 
40
  with gr.Row():
41
  files = files_create_ui(
42
  label="{} ({})".format(
43
+ config_data.OtherMessages_VIDEO_FILES[
44
+ config_data.AppSettings_DEFAULT_LANG_ID
45
+ ],
46
  ", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
47
  ),
48
  file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
 
592
  )
593
 
594
  return (
595
+ description,
596
+ step_1,
597
  notifications,
598
  files,
599
  video,
config.toml CHANGED
@@ -1,8 +1,13 @@
1
  [AppSettings]
2
- APP_VERSION = "0.8.7"
3
  CSS_PATH = "app.css"
 
4
 
5
  [InformationMessages]
 
 
 
 
6
  NOTI_VIDEOS = "Select the video(s)"
7
  PRACTICAL_TASKS_INFO = "Choose a practical task"
8
  PRACTICAL_SUBTASKS_INFO = "Choose a practical subtask"
@@ -14,11 +19,17 @@ DROPDOWN_CANDIDATES_INFO = "What profession are you interested in?"
14
  DROPDOWN_LANGUAGES_INFO = "Select the language of the app"
15
  VALUE_FROM_TO_INFO = "Set value from {} to {}"
16
  SUM_WEIGHTS = "The sum of the weights of the personality traits should be 100, not {}"
17
- STEP_1 = "Step 1: Calculation of personality traits scores"
18
- STEP_2 = "Step 2: Solving practical task"
 
 
 
 
 
 
19
 
20
  [OtherMessages]
21
- VIDEO_FILES = "Video Files"
22
  CALCULATE_PT_SCORES = "Calculation of Big Five personality traits scores"
23
  CALCULATE_PT_SCORES_ERR = "Personality traits scores have not been calculated. Try uploading a different file(s)"
24
  CALCULATE_PRACTICAL_TASK = "Solving practical task"
@@ -73,13 +84,26 @@ MDA_CATEGORIES = "divice_characteristics_priorities.csv"
73
  POTENTIAL_CANDIDATES = "potential_candidates.csv"
74
  MBTI_JOB = "mbti_job_match.csv"
75
 
 
 
 
 
 
 
76
  [Settings]
77
  LANGUAGES_EN = ["English", "Russian"]
78
  LANGUAGES_RU = ["Английский", "Русский"]
79
  SHORT_PROFESSIONAL_SKILLS = ["OPE", "CON", "EXT", "AGR", "NNEU"]
80
  DROPDOWN_PROFESSIONAL_SKILLS = ["Analytical", "Interactive", "Routine", "Non-Routine"]
81
  DROPDOWN_COLLEAGUES = ["major", "minor"]
82
- DROPDOWN_CANDIDATES = ["Managers/executives", "Entrepreneurship", "Social/Non profit making professions", "Public sector professions", "Scientists/researchers, and engineers", "Custom"]
 
 
 
 
 
 
 
83
  DROPDOWN_MBTI = [
84
  "The Inspector (ISTJ): Accountant, Auditor, Budget Analyst, Financial Manager, Developer, Systems Analyst, Librarian etc.",
85
  "The Protector (ISFJ): Nurse, Doctor, Veterinarian or Veterinary Nurse/Assistant, Social Worker, Agricultural or Food Scientist, Secretary, Driver, etc.",
 
1
  [AppSettings]
2
+ APP_VERSION = "0.8.8"
3
  CSS_PATH = "app.css"
4
+ DEFAULT_LANG_ID = 0
5
 
6
  [InformationMessages]
7
+ DESCRIPTIONS = [
8
+ "is an open-source framework for Big Five personality traits assessment and HR-processes automatization",
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"
 
19
  DROPDOWN_LANGUAGES_INFO = "Select the language of the app"
20
  VALUE_FROM_TO_INFO = "Set value from {} to {}"
21
  SUM_WEIGHTS = "The sum of the weights of the personality traits should be 100, not {}"
22
+ STEP_1 = [
23
+ "Step 1: Calculation of personality traits scores",
24
+ "Шаг 1: Вычисление оценок персональных качеств личности человека",
25
+ ]
26
+ STEP_2 = [
27
+ "Step 2: Solving practical task",
28
+ "Шаг 2: Решение практической задачи",
29
+ ]
30
 
31
  [OtherMessages]
32
+ VIDEO_FILES = ["Video Files", "Видеофайлы"]
33
  CALCULATE_PT_SCORES = "Calculation of Big Five personality traits scores"
34
  CALCULATE_PT_SCORES_ERR = "Personality traits scores have not been calculated. Try uploading a different file(s)"
35
  CALCULATE_PRACTICAL_TASK = "Solving practical task"
 
84
  POTENTIAL_CANDIDATES = "potential_candidates.csv"
85
  MBTI_JOB = "mbti_job_match.csv"
86
 
87
+ [Images]
88
+ LANGUAGES = ["UK.png", "RU.png"]
89
+
90
+ [StaticPaths]
91
+ IMAGES = "images/"
92
+
93
  [Settings]
94
  LANGUAGES_EN = ["English", "Russian"]
95
  LANGUAGES_RU = ["Английский", "Русский"]
96
  SHORT_PROFESSIONAL_SKILLS = ["OPE", "CON", "EXT", "AGR", "NNEU"]
97
  DROPDOWN_PROFESSIONAL_SKILLS = ["Analytical", "Interactive", "Routine", "Non-Routine"]
98
  DROPDOWN_COLLEAGUES = ["major", "minor"]
99
+ DROPDOWN_CANDIDATES = [
100
+ "Managers/executives",
101
+ "Entrepreneurship",
102
+ "Social/Non profit making professions",
103
+ "Public sector professions",
104
+ "Scientists/researchers, and engineers",
105
+ "Custom",
106
+ ]
107
  DROPDOWN_MBTI = [
108
  "The Inspector (ISTJ): Accountant, Auditor, Budget Analyst, Financial Manager, Developer, Systems Analyst, Librarian etc.",
109
  "The Protector (ISFJ): Nurse, Doctor, Veterinarian or Veterinary Nurse/Assistant, Social Worker, Agricultural or Food Scientist, Secretary, Driver, etc.",