Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -142,9 +142,15 @@ for j, tab in enumerate(audio_tabs):
|
|
| 142 |
# Labelling tickes of y-axis ('1','2','3',...)
|
| 143 |
pred_tick_list = [1,2]
|
| 144 |
ax1.set_yticklabels(["Lectuerer","Audience"])
|
| 145 |
-
|
| 146 |
-
#
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
ax1.tick_params(axis='x', labelrotation=90)
|
| 149 |
# Setting graph attribute
|
| 150 |
ax1.grid(True)
|
|
@@ -153,8 +159,8 @@ for j, tab in enumerate(audio_tabs):
|
|
| 153 |
for j, row in enumerate(lecturer_speaker_list):
|
| 154 |
ax1.broken_barh(row, ((j+1)*5-1, 3), facecolors =(pred_colors[j]))
|
| 155 |
|
| 156 |
-
f.set_figheight(
|
| 157 |
-
f.set_figwidth(
|
| 158 |
|
| 159 |
tab.pyplot(f)
|
| 160 |
|
|
@@ -175,7 +181,7 @@ for j, tab in enumerate(audio_tabs):
|
|
| 175 |
)
|
| 176 |
|
| 177 |
tab.write("Total length of audio: {}h:{:02d}m:{:02d}s".format(int(totalSeconds/3600),int((totalSeconds%3600)/60),int(totalSeconds%60)))
|
| 178 |
-
|
| 179 |
#tab.write("Lecturer spoke: {}h:{:02d}m:{:02d}s -> {:.2f}% of time".format(int(lecturer_speaker_times[0]/3600),
|
| 180 |
# int((lecturer_speaker_times[0]%3600)/60),int(lecturer_speaker_times[0]%60),
|
| 181 |
# 100*lecturer_speaker_times[0]/totalSeconds))
|
|
@@ -206,7 +212,8 @@ for j, tab in enumerate(audio_tabs):
|
|
| 206 |
# Labelling tickes of y-axis ('1','2','3',...)
|
| 207 |
pred_tick_list = range(1,pred_count+1)
|
| 208 |
ax1.set_yticklabels([str(element) for element in pred_tick_list])
|
| 209 |
-
|
|
|
|
| 210 |
ax1.set_xticks(x_tick_list)
|
| 211 |
ax1.set_xticklabels([str(int(element/60)) for element in x_tick_list])
|
| 212 |
ax1.tick_params(axis='x', labelrotation=90)
|
|
@@ -217,8 +224,8 @@ for j, tab in enumerate(audio_tabs):
|
|
| 217 |
for j, row in enumerate(sortedSpeakerList):
|
| 218 |
ax1.broken_barh(row, ((j+1)*5-1, 3), facecolors =(pred_colors[j]))
|
| 219 |
|
| 220 |
-
f.set_figheight(
|
| 221 |
-
f.set_figwidth(
|
| 222 |
|
| 223 |
tab.pyplot(f)
|
| 224 |
|
|
@@ -232,7 +239,7 @@ for j, tab in enumerate(audio_tabs):
|
|
| 232 |
)
|
| 233 |
|
| 234 |
tab.write("Total length of audio: {}h:{:02d}m:{:02d}s".format(int(totalSeconds/3600),int((totalSeconds%3600)/60),int(totalSeconds%60)))
|
| 235 |
-
|
| 236 |
|
| 237 |
#for i,speaker in enumerate(all_speaker_times):
|
| 238 |
# tab.write("Speaker {} spoke: {}h:{:02d}m:{:02d}s -> {:.2f}% of time".format(i,
|
|
|
|
| 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
|
| 148 |
+
if end > 6000:
|
| 149 |
+
# Longer than 100 minutes, set to 5 minute interval
|
| 150 |
+
stepSize = 300
|
| 151 |
+
x_tick_list = range(0,int(end),stepSize)
|
| 152 |
+
ax1.set_xticks(x_tick_list)
|
| 153 |
+
ax1.set_xticklabels([str(int(element/60)) for element in x_tick_list])
|
| 154 |
ax1.tick_params(axis='x', labelrotation=90)
|
| 155 |
# Setting graph attribute
|
| 156 |
ax1.grid(True)
|
|
|
|
| 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 |
|
| 165 |
tab.pyplot(f)
|
| 166 |
|
|
|
|
| 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),
|
| 186 |
# int((lecturer_speaker_times[0]%3600)/60),int(lecturer_speaker_times[0]%60),
|
| 187 |
# 100*lecturer_speaker_times[0]/totalSeconds))
|
|
|
|
| 212 |
# Labelling tickes of y-axis ('1','2','3',...)
|
| 213 |
pred_tick_list = range(1,pred_count+1)
|
| 214 |
ax1.set_yticklabels([str(element) for element in pred_tick_list])
|
| 215 |
+
# Reuse above x limits
|
| 216 |
+
#x_tick_list = range(0,6000,60)
|
| 217 |
ax1.set_xticks(x_tick_list)
|
| 218 |
ax1.set_xticklabels([str(int(element/60)) for element in x_tick_list])
|
| 219 |
ax1.tick_params(axis='x', labelrotation=90)
|
|
|
|
| 224 |
for j, row in enumerate(sortedSpeakerList):
|
| 225 |
ax1.broken_barh(row, ((j+1)*5-1, 3), facecolors =(pred_colors[j]))
|
| 226 |
|
| 227 |
+
f.set_figheight(3)
|
| 228 |
+
f.set_figwidth(10)
|
| 229 |
|
| 230 |
tab.pyplot(f)
|
| 231 |
|
|
|
|
| 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)
|
| 243 |
|
| 244 |
#for i,speaker in enumerate(all_speaker_times):
|
| 245 |
# tab.write("Speaker {} spoke: {}h:{:02d}m:{:02d}s -> {:.2f}% of time".format(i,
|