czyoung commited on
Commit
ac3f151
·
verified ·
1 Parent(s): 89609f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -136,12 +136,16 @@ for j, tab in enumerate(audio_tabs):
136
  ax1.spines.top.set_visible(False)
137
 
138
 
 
 
 
 
139
  # Setting ticks on y-axis (5,10,15,...)
140
  step = 5
141
  ax1.set_yticks(list(range(step,(lecturer_pred_count+1)*step,step)))
142
  # Labelling tickes of y-axis ('1','2','3',...)
143
  pred_tick_list = [1,2]
144
- ax1.set_yticklabels(["Lectuerer","Audience"])
145
  start, end = ax1.get_xlim()
146
  # Stepsize of 1 minute by default
147
  stepSize = 60
@@ -155,10 +159,6 @@ for j, tab in enumerate(audio_tabs):
155
  # Setting graph attribute
156
  ax1.grid(True)
157
 
158
- pred_colors = su.colors(lecturer_pred_count)
159
- for j, row in enumerate(lecturer_speaker_list):
160
- ax1.broken_barh(row, ((j+1)*5-1, 3), facecolors =(pred_colors[j]))
161
-
162
  f.set_figheight(1)
163
  f.set_figwidth(10)
164
 
@@ -166,7 +166,6 @@ for j, tab in enumerate(audio_tabs):
166
 
167
  df = pd.DataFrame(
168
  {
169
- "Speaker": ["Lecturer", "Audience"],
170
  "Time spoken": ["{}h:{:02d}m:{:02d}s".format(int(lecturer_speaker_times[0]/3600),
171
  int((lecturer_speaker_times[0]%3600)/60),
172
  int(lecturer_speaker_times[0]%60)),
@@ -179,7 +178,10 @@ for j, tab in enumerate(audio_tabs):
179
  ],
180
  }
181
  )
182
-
 
 
 
183
  tab.write("Total length of audio: {}h:{:02d}m:{:02d}s".format(int(totalSeconds/3600),int((totalSeconds%3600)/60),int(totalSeconds%60)))
184
  tab.table(df)
185
  #tab.write("Lecturer spoke: {}h:{:02d}m:{:02d}s -> {:.2f}% of time".format(int(lecturer_speaker_times[0]/3600),
@@ -237,6 +239,10 @@ for j, tab in enumerate(audio_tabs):
237
  "Percentage": ["{:.2f}%".format(100*sp/totalSeconds) for sp in all_speaker_times],
238
  }
239
  )
 
 
 
 
240
 
241
  tab.write("Total length of audio: {}h:{:02d}m:{:02d}s".format(int(totalSeconds/3600),int((totalSeconds%3600)/60),int(totalSeconds%60)))
242
  tab.table(df)
 
136
  ax1.spines.top.set_visible(False)
137
 
138
 
139
+ pred_colors = su.colors(lecturer_pred_count)
140
+ for j, row in enumerate(lecturer_speaker_list):
141
+ ax1.broken_barh(row, ((j+1)*5-1, 3), facecolors =(pred_colors[j]))
142
+
143
  # Setting ticks on y-axis (5,10,15,...)
144
  step = 5
145
  ax1.set_yticks(list(range(step,(lecturer_pred_count+1)*step,step)))
146
  # Labelling tickes of y-axis ('1','2','3',...)
147
  pred_tick_list = [1,2]
148
+ ax1.set_yticklabels(["Lecturer","Audience"])
149
  start, end = ax1.get_xlim()
150
  # Stepsize of 1 minute by default
151
  stepSize = 60
 
159
  # Setting graph attribute
160
  ax1.grid(True)
161
 
 
 
 
 
162
  f.set_figheight(1)
163
  f.set_figwidth(10)
164
 
 
166
 
167
  df = pd.DataFrame(
168
  {
 
169
  "Time spoken": ["{}h:{:02d}m:{:02d}s".format(int(lecturer_speaker_times[0]/3600),
170
  int((lecturer_speaker_times[0]%3600)/60),
171
  int(lecturer_speaker_times[0]%60)),
 
178
  ],
179
  }
180
  )
181
+ df.style \
182
+ .format_index(str.upper, axis=1) \
183
+ .relabel_index(["Lecturer", "Audience"], axis=0) \
184
+ .set_properties({"background-color": "white"])
185
  tab.write("Total length of audio: {}h:{:02d}m:{:02d}s".format(int(totalSeconds/3600),int((totalSeconds%3600)/60),int(totalSeconds%60)))
186
  tab.table(df)
187
  #tab.write("Lecturer spoke: {}h:{:02d}m:{:02d}s -> {:.2f}% of time".format(int(lecturer_speaker_times[0]/3600),
 
239
  "Percentage": ["{:.2f}%".format(100*sp/totalSeconds) for sp in all_speaker_times],
240
  }
241
  )
242
+ df.style \
243
+ .format_index(str.upper, axis=1) \
244
+ .relabel_index([f"speaker {sp}" for sp in range(len(all_speaker_times))], axis=0) \
245
+ .set_properties({"background-color": "white"])
246
 
247
  tab.write("Total length of audio: {}h:{:02d}m:{:02d}s".format(int(totalSeconds/3600),int((totalSeconds%3600)/60),int(totalSeconds%60)))
248
  tab.table(df)