fix plots
Browse files
app.py
CHANGED
@@ -238,7 +238,23 @@ def strike(url, speedup_factor, min_speedup, max_speedup, max_num_segments):
|
|
238 |
data = [times, np.repeat(speedups, 2)]
|
239 |
cols = ["time (minutes)", "speedup"]
|
240 |
df = pd.DataFrame(list(zip(*data)), columns=cols)
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
|
243 |
return output_path
|
244 |
|
@@ -256,7 +272,11 @@ with st.form("my_form"):
|
|
256 |
)
|
257 |
submitted = st.form_submit_button("submit")
|
258 |
if submitted:
|
259 |
-
|
260 |
-
|
261 |
-
)
|
|
|
|
|
|
|
|
|
262 |
st.audio(output_path)
|
|
|
238 |
data = [times, np.repeat(speedups, 2)]
|
239 |
cols = ["time (minutes)", "speedup"]
|
240 |
df = pd.DataFrame(list(zip(*data)), columns=cols)
|
241 |
+
min_actual_speedups = min(speedups)
|
242 |
+
max_actual_speedups = max(speedups)
|
243 |
+
eps = 0.1
|
244 |
+
lines = (
|
245 |
+
alt.Chart(df, title="speedup based on information rate")
|
246 |
+
.mark_line()
|
247 |
+
.encode(
|
248 |
+
x=cols[0],
|
249 |
+
y=alt.Y(
|
250 |
+
cols[1],
|
251 |
+
scale=alt.Scale(
|
252 |
+
domain=(min_actual_speedups - eps, max_actual_speedups + eps)
|
253 |
+
),
|
254 |
+
),
|
255 |
+
)
|
256 |
+
)
|
257 |
+
st.altair_chart(lines.interactive(), use_container_width=True)
|
258 |
|
259 |
return output_path
|
260 |
|
|
|
272 |
)
|
273 |
submitted = st.form_submit_button("submit")
|
274 |
if submitted:
|
275 |
+
st.write("original video:")
|
276 |
+
st.video(url)
|
277 |
+
with st.spinner("processing audio..."):
|
278 |
+
output_path = strike(
|
279 |
+
url, speedup_factor, min_speedup, max_speedup, max_num_segments
|
280 |
+
)
|
281 |
+
st.write("processed audio:")
|
282 |
st.audio(output_path)
|