Spaces:
Running
Running
temporary fix for recording purposes
Browse files- src/streamlit_app.py +55 -44
src/streamlit_app.py
CHANGED
@@ -1,76 +1,87 @@
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
|
4 |
-
# Video directory
|
5 |
VIDEO_FOLDER = "./src/synthda_falling_realreal/"
|
6 |
|
7 |
-
#
|
8 |
-
st.set_page_config(layout="wide")
|
9 |
|
10 |
-
#
|
11 |
st.markdown("""
|
12 |
-
<
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
""", unsafe_allow_html=True)
|
20 |
|
21 |
-
#
|
22 |
-
st.markdown(
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
# Slider
|
28 |
-
weight = st.slider("Interpolation Weight", 0.1, 0.9, 0.5, step=0.1)
|
29 |
|
30 |
-
# Interpolation
|
31 |
if weight == 0.0:
|
32 |
interp_text = "Showing Input Video 1 (no interpolation)"
|
33 |
elif weight == 1.0:
|
34 |
interp_text = "Showing Input Video 2 (no interpolation)"
|
35 |
else:
|
36 |
w2 = round(1.0 - weight, 1)
|
37 |
-
interp_text = f"
|
38 |
|
39 |
-
st.markdown(f
|
40 |
|
41 |
-
#
|
42 |
filename_interp = f"videos_generated_{weight:.1f}.mp4"
|
43 |
-
filename_input1 = "videos_generated_0.0.mp4"
|
44 |
-
filename_input2 = "videos_generated_1.0.mp4"
|
45 |
-
|
46 |
video_interp = os.path.join(VIDEO_FOLDER, filename_interp)
|
47 |
-
video_input1 = os.path.join(VIDEO_FOLDER,
|
48 |
-
video_input2 = os.path.join(VIDEO_FOLDER,
|
49 |
-
|
50 |
-
exists_interp = os.path.exists(video_interp)
|
51 |
-
exists_1 = os.path.exists(video_input1)
|
52 |
-
exists_2 = os.path.exists(video_input2)
|
53 |
|
54 |
-
#
|
55 |
-
col1, col2
|
56 |
|
57 |
with col1:
|
58 |
-
st.markdown("<div
|
59 |
-
if
|
60 |
st.video(video_input1)
|
61 |
else:
|
62 |
st.error("Video 1 not found")
|
63 |
|
64 |
with col2:
|
65 |
-
st.markdown("<div
|
66 |
-
if
|
67 |
-
st.video(video_interp)
|
68 |
-
else:
|
69 |
-
st.error("Interpolated video not found")
|
70 |
-
|
71 |
-
with col3:
|
72 |
-
st.markdown("<div style='text-align: center; font-weight: bold;'>Input Video 2</div>", unsafe_allow_html=True)
|
73 |
-
if exists_2:
|
74 |
st.video(video_input2)
|
75 |
else:
|
76 |
st.error("Video 2 not found")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
|
|
|
4 |
VIDEO_FOLDER = "./src/synthda_falling_realreal/"
|
5 |
|
6 |
+
# Page config optimized for screen recording
|
7 |
+
st.set_page_config(layout="wide", initial_sidebar_state="collapsed")
|
8 |
|
9 |
+
# Custom CSS to center and reduce spacing
|
10 |
st.markdown("""
|
11 |
+
<style>
|
12 |
+
html, body, [class*="css"] {
|
13 |
+
padding: 0;
|
14 |
+
margin: 0;
|
15 |
+
font-size: 14px;
|
16 |
+
}
|
17 |
+
.block-container {
|
18 |
+
padding-top: 1rem;
|
19 |
+
padding-bottom: 0rem;
|
20 |
+
}
|
21 |
+
.video-wrapper {
|
22 |
+
display: flex;
|
23 |
+
justify-content: center;
|
24 |
+
}
|
25 |
+
.video-caption {
|
26 |
+
text-align: center;
|
27 |
+
font-weight: bold;
|
28 |
+
margin-bottom: 0.2rem;
|
29 |
+
}
|
30 |
+
</style>
|
31 |
""", unsafe_allow_html=True)
|
32 |
|
33 |
+
# Compact title and description
|
34 |
+
st.markdown("""
|
35 |
+
<h2 style='text-align: center;'>Project SynthDa</h2>
|
36 |
+
<p style='text-align: center;'>
|
37 |
+
AutoSynthDa generates synthetic action videos by interpolating between two input motions.<br>
|
38 |
+
Move the slider to explore the effect of blending.
|
39 |
+
</p>
|
40 |
+
<p style='text-align: center;'>
|
41 |
+
<a href="https://github.com/nvidia/synthda" target="_blank">github.com/nvidia/synthda</a>
|
42 |
+
</p>
|
43 |
+
""", unsafe_allow_html=True)
|
44 |
|
45 |
+
# Slider with default at midpoint
|
46 |
+
weight = st.slider("Interpolation Weight (0 = Left Video, 1 = Right Video)", 0.1, 0.9, 0.5, step=0.1)
|
47 |
|
48 |
+
# Interpolation text
|
49 |
if weight == 0.0:
|
50 |
interp_text = "Showing Input Video 1 (no interpolation)"
|
51 |
elif weight == 1.0:
|
52 |
interp_text = "Showing Input Video 2 (no interpolation)"
|
53 |
else:
|
54 |
w2 = round(1.0 - weight, 1)
|
55 |
+
interp_text = f"{weight:.1f} from Input 1 + {w2:.1f} from Input 2"
|
56 |
|
57 |
+
st.markdown(f"<p style='text-align:center;'><strong>{interp_text}</strong></p>", unsafe_allow_html=True)
|
58 |
|
59 |
+
# File paths
|
60 |
filename_interp = f"videos_generated_{weight:.1f}.mp4"
|
|
|
|
|
|
|
61 |
video_interp = os.path.join(VIDEO_FOLDER, filename_interp)
|
62 |
+
video_input1 = os.path.join(VIDEO_FOLDER, "videos_generated_0.0.mp4")
|
63 |
+
video_input2 = os.path.join(VIDEO_FOLDER, "videos_generated_1.0.mp4")
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
# 2 columns only
|
66 |
+
col1, col2 = st.columns([1, 1])
|
67 |
|
68 |
with col1:
|
69 |
+
st.markdown("<div class='video-caption'>Input Video 1</div>", unsafe_allow_html=True)
|
70 |
+
if os.path.exists(video_input1):
|
71 |
st.video(video_input1)
|
72 |
else:
|
73 |
st.error("Video 1 not found")
|
74 |
|
75 |
with col2:
|
76 |
+
st.markdown("<div class='video-caption'>Input Video 2</div>", unsafe_allow_html=True)
|
77 |
+
if os.path.exists(video_input2):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
st.video(video_input2)
|
79 |
else:
|
80 |
st.error("Video 2 not found")
|
81 |
+
|
82 |
+
# Below the two main inputs, show the interpolated video centered
|
83 |
+
st.markdown("<div class='video-caption'>Interpolated Output</div>", unsafe_allow_html=True)
|
84 |
+
if os.path.exists(video_interp):
|
85 |
+
st.video(video_interp)
|
86 |
+
else:
|
87 |
+
st.error("Interpolated video not found")
|