Spaces:
Running
Running
temporary fix for recordingz
Browse files- src/streamlit_app.py +45 -22
src/streamlit_app.py
CHANGED
@@ -3,13 +3,13 @@ import os
|
|
3 |
|
4 |
VIDEO_FOLDER = "./src/synthda_falling_realreal/"
|
5 |
|
6 |
-
# Page
|
7 |
st.set_page_config(layout="wide", initial_sidebar_state="collapsed")
|
8 |
|
9 |
-
# Custom
|
10 |
st.markdown("""
|
11 |
<style>
|
12 |
-
html, body, [class*="css"]
|
13 |
padding: 0;
|
14 |
margin: 0;
|
15 |
font-size: 14px;
|
@@ -22,6 +22,12 @@ st.markdown("""
|
|
22 |
display: flex;
|
23 |
justify-content: center;
|
24 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
.video-caption {
|
26 |
text-align: center;
|
27 |
font-weight: bold;
|
@@ -30,22 +36,21 @@ st.markdown("""
|
|
30 |
</style>
|
31 |
""", unsafe_allow_html=True)
|
32 |
|
33 |
-
#
|
34 |
st.markdown("""
|
35 |
<h2 style='text-align: center;'>Project SynthDa</h2>
|
|
|
36 |
<p style='text-align: center;'>
|
37 |
-
AutoSynthDa
|
38 |
-
|
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
|
46 |
weight = st.slider("Interpolation Weight (0 = Left Video, 1 = Right Video)", 0.1, 0.9, 0.5, step=0.1)
|
47 |
|
48 |
-
# Interpolation
|
49 |
if weight == 0.0:
|
50 |
interp_text = "Showing Input Video 1 (no interpolation)"
|
51 |
elif weight == 1.0:
|
@@ -56,32 +61,50 @@ else:
|
|
56 |
|
57 |
st.markdown(f"<p style='text-align:center;'><strong>{interp_text}</strong></p>", unsafe_allow_html=True)
|
58 |
|
59 |
-
#
|
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 |
-
#
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
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")
|
|
|
3 |
|
4 |
VIDEO_FOLDER = "./src/synthda_falling_realreal/"
|
5 |
|
6 |
+
# Page layout settings
|
7 |
st.set_page_config(layout="wide", initial_sidebar_state="collapsed")
|
8 |
|
9 |
+
# Custom styles for centering and reducing video size
|
10 |
st.markdown("""
|
11 |
<style>
|
12 |
+
html, body, [class*="css"] {
|
13 |
padding: 0;
|
14 |
margin: 0;
|
15 |
font-size: 14px;
|
|
|
22 |
display: flex;
|
23 |
justify-content: center;
|
24 |
}
|
25 |
+
video {
|
26 |
+
width: 100%;
|
27 |
+
max-width: 300px; /* Shrink video */
|
28 |
+
height: auto;
|
29 |
+
border-radius: 6px;
|
30 |
+
}
|
31 |
.video-caption {
|
32 |
text-align: center;
|
33 |
font-weight: bold;
|
|
|
36 |
</style>
|
37 |
""", unsafe_allow_html=True)
|
38 |
|
39 |
+
# Title and description
|
40 |
st.markdown("""
|
41 |
<h2 style='text-align: center;'>Project SynthDa</h2>
|
42 |
+
<h4 style='text-align: center;'>SynthDa Interpolation Demo Viewer</h4>
|
43 |
<p style='text-align: center;'>
|
44 |
+
AutoSynthDa blends two input motion videos to <strong>generate kinematically coherent, synthetic action videos</strong>.<br>
|
45 |
+
Use the slider below to explore how the system interpolates motion from one video to another.<br>
|
|
|
|
|
46 |
<a href="https://github.com/nvidia/synthda" target="_blank">github.com/nvidia/synthda</a>
|
47 |
</p>
|
48 |
""", unsafe_allow_html=True)
|
49 |
|
50 |
+
# Slider
|
51 |
weight = st.slider("Interpolation Weight (0 = Left Video, 1 = Right Video)", 0.1, 0.9, 0.5, step=0.1)
|
52 |
|
53 |
+
# Interpolation status
|
54 |
if weight == 0.0:
|
55 |
interp_text = "Showing Input Video 1 (no interpolation)"
|
56 |
elif weight == 1.0:
|
|
|
61 |
|
62 |
st.markdown(f"<p style='text-align:center;'><strong>{interp_text}</strong></p>", unsafe_allow_html=True)
|
63 |
|
64 |
+
# Video paths
|
65 |
filename_interp = f"videos_generated_{weight:.1f}.mp4"
|
66 |
video_interp = os.path.join(VIDEO_FOLDER, filename_interp)
|
67 |
video_input1 = os.path.join(VIDEO_FOLDER, "videos_generated_0.0.mp4")
|
68 |
video_input2 = os.path.join(VIDEO_FOLDER, "videos_generated_1.0.mp4")
|
69 |
|
70 |
+
# 3 videos in row
|
71 |
+
col1, col2, col3 = st.columns([1, 1, 1])
|
72 |
|
73 |
with col1:
|
74 |
st.markdown("<div class='video-caption'>Input Video 1</div>", unsafe_allow_html=True)
|
75 |
if os.path.exists(video_input1):
|
76 |
+
st.markdown(f"""
|
77 |
+
<div class='video-wrapper'>
|
78 |
+
<video controls>
|
79 |
+
<source src="{video_input1}" type="video/mp4">
|
80 |
+
</video>
|
81 |
+
</div>
|
82 |
+
""", unsafe_allow_html=True)
|
83 |
else:
|
84 |
st.error("Video 1 not found")
|
85 |
|
86 |
with col2:
|
87 |
+
st.markdown("<div class='video-caption'>Interpolated Video</div>", unsafe_allow_html=True)
|
88 |
+
if os.path.exists(video_interp):
|
89 |
+
st.markdown(f"""
|
90 |
+
<div class='video-wrapper'>
|
91 |
+
<video controls>
|
92 |
+
<source src="{video_interp}" type="video/mp4">
|
93 |
+
</video>
|
94 |
+
</div>
|
95 |
+
""", unsafe_allow_html=True)
|
96 |
+
else:
|
97 |
+
st.error("Interpolated video not found")
|
98 |
+
|
99 |
+
with col3:
|
100 |
st.markdown("<div class='video-caption'>Input Video 2</div>", unsafe_allow_html=True)
|
101 |
if os.path.exists(video_input2):
|
102 |
+
st.markdown(f"""
|
103 |
+
<div class='video-wrapper'>
|
104 |
+
<video controls>
|
105 |
+
<source src="{video_input2}" type="video/mp4">
|
106 |
+
</video>
|
107 |
+
</div>
|
108 |
+
""", unsafe_allow_html=True)
|
109 |
else:
|
110 |
st.error("Video 2 not found")
|
|
|
|
|
|
|
|
|
|
|
|
|
|