fix tooltip
Browse files- app.py +25 -9
- example.png +2 -2
app.py
CHANGED
@@ -217,23 +217,33 @@ def strike(url, speedup_factor, min_speedup, max_speedup, max_num_segments):
|
|
217 |
max_time = segments[-1]["end"] / 60
|
218 |
lines = (
|
219 |
alt.Chart(df, title="information rate")
|
220 |
-
.mark_line(color="gray"
|
221 |
.encode(
|
222 |
x=alt.X(cols[0], scale=alt.Scale(domain=(min_time, max_time))),
|
223 |
y=cols[1],
|
224 |
)
|
225 |
)
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
alt.Chart(df)
|
228 |
-
.
|
229 |
.encode(
|
230 |
x=alt.X(cols[0], scale=alt.Scale(domain=(min_time, max_time))),
|
231 |
y=cols[1],
|
232 |
-
|
|
|
233 |
)
|
|
|
234 |
)
|
235 |
-
|
236 |
-
st.
|
|
|
237 |
|
238 |
st.write("sped-up audio:")
|
239 |
st.audio(output_path)
|
@@ -288,9 +298,15 @@ with st.form("my_form"):
|
|
288 |
url = st.text_input(
|
289 |
"youtube url", value="https://www.youtube.com/watch?v=_3MBQm7GFIM"
|
290 |
)
|
291 |
-
speedup_factor = st.slider(
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
max_num_segments = st.slider(
|
295 |
"variance in speedup across segments", min_value=2, max_value=100, value=20
|
296 |
)
|
|
|
217 |
max_time = segments[-1]["end"] / 60
|
218 |
lines = (
|
219 |
alt.Chart(df, title="information rate")
|
220 |
+
.mark_line(color="gray")
|
221 |
.encode(
|
222 |
x=alt.X(cols[0], scale=alt.Scale(domain=(min_time, max_time))),
|
223 |
y=cols[1],
|
224 |
)
|
225 |
)
|
226 |
+
hover = alt.selection_single(
|
227 |
+
fields=cols[:1],
|
228 |
+
nearest=True,
|
229 |
+
on="mouseover",
|
230 |
+
empty="none",
|
231 |
+
)
|
232 |
+
points = lines.transform_filter(hover).mark_circle(size=65, color="orange")
|
233 |
+
tooltips = (
|
234 |
alt.Chart(df)
|
235 |
+
.mark_rule(color="orange")
|
236 |
.encode(
|
237 |
x=alt.X(cols[0], scale=alt.Scale(domain=(min_time, max_time))),
|
238 |
y=cols[1],
|
239 |
+
opacity=alt.condition(hover, alt.value(1), alt.value(0)),
|
240 |
+
tooltip=[alt.Tooltip("transcript", title="transcript")],
|
241 |
)
|
242 |
+
.add_selection(hover)
|
243 |
)
|
244 |
+
chart = (lines + points + tooltips).interactive()
|
245 |
+
st.altair_chart(chart, use_container_width=True)
|
246 |
+
st.info("hover over the plot above this message to read the transcript")
|
247 |
|
248 |
st.write("sped-up audio:")
|
249 |
st.audio(output_path)
|
|
|
298 |
url = st.text_input(
|
299 |
"youtube url", value="https://www.youtube.com/watch?v=_3MBQm7GFIM"
|
300 |
)
|
301 |
+
speedup_factor = st.slider(
|
302 |
+
"overall speedup for entire file", min_value=0.5, max_value=5.0, value=1.5
|
303 |
+
)
|
304 |
+
min_speedup = st.slider(
|
305 |
+
"minimum speedup per segment", min_value=0.5, max_value=5.0, value=1.0
|
306 |
+
)
|
307 |
+
max_speedup = st.slider(
|
308 |
+
"maximum speedup per segment", min_value=0.5, max_value=5.0, value=2.0
|
309 |
+
)
|
310 |
max_num_segments = st.slider(
|
311 |
"variance in speedup across segments", min_value=2, max_value=100, value=20
|
312 |
)
|
example.png
CHANGED
Git LFS Details
|
Git LFS Details
|