DmitryRyumin commited on
Commit
756b5e5
β€’
1 Parent(s): 32d3e4c
app.css CHANGED
@@ -29,6 +29,10 @@ div.files-container {
29
  max-height: 350px;
30
  }
31
 
 
 
 
 
32
  div.files-container div.icon-buttons > button,
33
  div.video-sorted-container div.icon-buttons > button {
34
  display: none;
 
29
  max-height: 350px;
30
  }
31
 
32
+ div.files-container tr {
33
+ padding-right: 20px;
34
+ }
35
+
36
  div.files-container div.icon-buttons > button,
37
  div.video-sorted-container div.icon-buttons > button {
38
  display: none;
app/components.py CHANGED
@@ -8,6 +8,9 @@ License: MIT License
8
  import gradio as gr
9
  from typing import Union, List, Callable, Optional, Literal
10
 
 
 
 
11
 
12
  def html_message(
13
  message: str = "", error: bool = True, visible: bool = True
@@ -21,7 +24,7 @@ def files_create_ui(
21
  value: Union[str, List[str], Callable, None] = None,
22
  file_count: str = "multiple",
23
  file_types: List = ["video"],
24
- label: str = "Video Files",
25
  show_label: bool = True,
26
  interactive: bool = True,
27
  visible: bool = True,
 
8
  import gradio as gr
9
  from typing import Union, List, Callable, Optional, Literal
10
 
11
+ # Importing necessary components for the Gradio app
12
+ from app.config import config_data
13
+
14
 
15
  def html_message(
16
  message: str = "", error: bool = True, visible: bool = True
 
24
  value: Union[str, List[str], Callable, None] = None,
25
  file_count: str = "multiple",
26
  file_types: List = ["video"],
27
+ label: str = config_data.OtherMessages_VIDEO_FILES,
28
  show_label: bool = True,
29
  interactive: bool = True,
30
  visible: bool = True,
app/event_handlers/calculate_pt_scores_blocks.py CHANGED
@@ -34,10 +34,116 @@ def event_handler_calculate_pt_scores_blocks(files, evt_data: gr.EventData):
34
  paths=files, url_accuracy="", accuracy=False, lang="en", out=out
35
  )
36
 
37
- b5.df_files_.to_csv(config_data.Filenames_PT_SCORES)
38
-
39
  first_practical_task = next(iter(supported_practical_tasks))
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  df_files = b5.df_files_.copy()
42
  df_files.reset_index(inplace=True)
43
 
 
34
  paths=files, url_accuracy="", accuracy=False, lang="en", out=out
35
  )
36
 
 
 
37
  first_practical_task = next(iter(supported_practical_tasks))
38
 
39
+ if len(b5.df_files_) == 0:
40
+ gr.Warning(config_data.OtherMessages_CALCULATE_PT_SCORES_ERR)
41
+
42
+ return (
43
+ html_message(config_data.OtherMessages_CALCULATE_PT_SCORES_ERR, False),
44
+ dataframe(visible=False),
45
+ files_create_ui(
46
+ None,
47
+ "single",
48
+ [".csv"],
49
+ config_data.OtherMessages_EXPORT_PT_SCORES,
50
+ True,
51
+ False,
52
+ False,
53
+ "csv-container",
54
+ ),
55
+ gr.HTML(value=STEP_2, visible=False),
56
+ gr.Column(visible=False),
57
+ radio_create_ui(
58
+ first_practical_task,
59
+ config_data.Labels_PRACTICAL_TASKS_LABEL,
60
+ list(map(str, supported_practical_tasks.keys())),
61
+ config_data.InformationMessages_PRACTICAL_TASKS_INFO,
62
+ True,
63
+ True,
64
+ ),
65
+ radio_create_ui(
66
+ supported_practical_tasks[first_practical_task][0],
67
+ config_data.Labels_PRACTICAL_SUBTASKS_LABEL,
68
+ supported_practical_tasks[first_practical_task],
69
+ config_data.InformationMessages_PRACTICAL_SUBTASKS_INFO,
70
+ True,
71
+ True,
72
+ ),
73
+ gr.JSON(
74
+ value={
75
+ str(task): supported_practical_tasks.get(task, [None])[0]
76
+ for task in supported_practical_tasks.keys()
77
+ },
78
+ visible=False,
79
+ render=True,
80
+ ),
81
+ gr.Column(visible=False),
82
+ dropdown_create_ui(visible=False),
83
+ number_create_ui(visible=False),
84
+ number_create_ui(visible=False),
85
+ dropdown_create_ui(visible=False),
86
+ number_create_ui(visible=False),
87
+ number_create_ui(visible=False),
88
+ number_create_ui(visible=False),
89
+ number_create_ui(visible=False),
90
+ number_create_ui(visible=False),
91
+ number_create_ui(visible=False),
92
+ number_create_ui(visible=False),
93
+ number_create_ui(visible=False),
94
+ number_create_ui(visible=False),
95
+ dropdown_create_ui(visible=False),
96
+ number_create_ui(visible=False),
97
+ number_create_ui(visible=False),
98
+ number_create_ui(visible=False),
99
+ number_create_ui(visible=False),
100
+ number_create_ui(visible=False),
101
+ button(
102
+ config_data.OtherMessages_CALCULATE_PRACTICAL_TASK,
103
+ True,
104
+ 1,
105
+ "./images/pt.ico",
106
+ False,
107
+ "calculate_practical_task",
108
+ ),
109
+ gr.Row(visible=False),
110
+ gr.Column(visible=False),
111
+ dataframe(visible=False),
112
+ files_create_ui(
113
+ None,
114
+ "single",
115
+ [".csv"],
116
+ config_data.OtherMessages_EXPORT_PS,
117
+ True,
118
+ False,
119
+ False,
120
+ "csv-container",
121
+ ),
122
+ gr.Accordion(visible=False),
123
+ gr.HTML(visible=False),
124
+ dataframe(visible=False),
125
+ gr.Column(visible=False),
126
+ video_create_ui(visible=False),
127
+ gr.Column(visible=False),
128
+ gr.Row(visible=False),
129
+ gr.Row(visible=False),
130
+ gr.Image(visible=False),
131
+ textbox_create_ui(visible=False),
132
+ gr.Row(visible=False),
133
+ gr.Image(visible=False),
134
+ textbox_create_ui(visible=False),
135
+ gr.Row(visible=False),
136
+ gr.Row(visible=False),
137
+ gr.Image(visible=False),
138
+ textbox_create_ui(visible=False),
139
+ gr.Row(visible=False),
140
+ gr.Image(visible=False),
141
+ textbox_create_ui(visible=False),
142
+ html_message(config_data.InformationMessages_NOTI_IN_DEV, False, False),
143
+ )
144
+
145
+ b5.df_files_.to_csv(config_data.Filenames_PT_SCORES)
146
+
147
  df_files = b5.df_files_.copy()
148
  df_files.reset_index(inplace=True)
149
 
app/event_handlers/clear_blocks.py CHANGED
@@ -29,7 +29,13 @@ def event_handler_clear_blocks():
29
 
30
  return (
31
  html_message(config_data.InformationMessages_NOTI_VIDEOS, False),
32
- files_create_ui(),
 
 
 
 
 
 
33
  video_create_ui(),
34
  button(
35
  config_data.OtherMessages_CALCULATE_PT_SCORES,
 
29
 
30
  return (
31
  html_message(config_data.InformationMessages_NOTI_VIDEOS, False),
32
+ files_create_ui(
33
+ label="{} ({})".format(
34
+ config_data.OtherMessages_VIDEO_FILES,
35
+ ", ".join(config_data.Settings_SUPPORTED_VIDEO_EXT),
36
+ ),
37
+ file_types=[f".{ext}" for ext in config_data.Settings_SUPPORTED_VIDEO_EXT],
38
+ ),
39
  video_create_ui(),
40
  button(
41
  config_data.OtherMessages_CALCULATE_PT_SCORES,
app/tabs.py CHANGED
@@ -36,7 +36,13 @@ def app_tab():
36
  gr.HTML(value=STEP_1)
37
 
38
  with gr.Row():
39
- files = files_create_ui(file_types=[".mp4"])
 
 
 
 
 
 
40
 
41
  video = video_create_ui()
42
 
 
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],
45
+ )
46
 
47
  video = video_create_ui()
48
 
config.toml CHANGED
@@ -1,5 +1,5 @@
1
  [AppSettings]
2
- APP_VERSION = "0.8.6"
3
  CSS_PATH = "app.css"
4
 
5
  [InformationMessages]
@@ -18,7 +18,9 @@ STEP_1 = "Step 1: Calculation of personality traits scores"
18
  STEP_2 = "Step 2: Solving practical task"
19
 
20
  [OtherMessages]
 
21
  CALCULATE_PT_SCORES = "Calculation of Big Five personality traits scores"
 
22
  CALCULATE_PRACTICAL_TASK = "Solving practical task"
23
  CLEAR_APP = "Clear"
24
  EXAMPLES_APP = "Examples"
@@ -98,6 +100,7 @@ DROPDOWN_MBTI = [
98
  ]
99
  DROPDOWN_MBTI_DEL_COLS = ["EI", "SN", "TF", "JP", "Match"]
100
  SHOW_VIDEO_METADATA = true
 
101
 
102
  [Values]
103
  TARGET_SCORES = [0.527886, 0.522337, 0.458468, 0.51761, 0.444649]
 
1
  [AppSettings]
2
+ APP_VERSION = "0.8.7"
3
  CSS_PATH = "app.css"
4
 
5
  [InformationMessages]
 
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"
25
  CLEAR_APP = "Clear"
26
  EXAMPLES_APP = "Examples"
 
100
  ]
101
  DROPDOWN_MBTI_DEL_COLS = ["EI", "SN", "TF", "JP", "Match"]
102
  SHOW_VIDEO_METADATA = true
103
+ SUPPORTED_VIDEO_EXT = ["mp4", "mov", "avi", "flv"]
104
 
105
  [Values]
106
  TARGET_SCORES = [0.527886, 0.522337, 0.458468, 0.51761, 0.444649]
requirements.txt CHANGED
@@ -2,6 +2,6 @@ gradio==4.23.0
2
  requests==2.31.0
3
  PyYAML==6.0.1
4
  toml==0.10.2
5
- oceanai==1.0.0a28
6
  tf-keras==2.16.0
7
  pandas==2.2.1
 
2
  requests==2.31.0
3
  PyYAML==6.0.1
4
  toml==0.10.2
5
+ oceanai==1.0.0a29
6
  tf-keras==2.16.0
7
  pandas==2.2.1