Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +24 -39
src/streamlit_app.py
CHANGED
|
@@ -6,69 +6,54 @@ VIDEO_FOLDER = "./src/synthda_falling_realreal/"
|
|
| 6 |
|
| 7 |
# Set page layout
|
| 8 |
st.set_page_config(layout="wide")
|
| 9 |
-
st.title("AutoSynthDa Pose Interpolation Viewer")
|
| 10 |
|
|
|
|
| 11 |
st.markdown("""
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
"""
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
# Slider instruction
|
| 20 |
st.markdown(
|
| 21 |
-
'<p style="text-align:center;"><strong>Use the slider to control the interpolation between Input Video 1 (left) and Input Video 2 (right).</strong></p>',
|
| 22 |
unsafe_allow_html=True
|
| 23 |
)
|
| 24 |
|
| 25 |
-
# Hide the orange filled track of the slider
|
| 26 |
-
st.markdown("""
|
| 27 |
-
<style>
|
| 28 |
-
/* Hide the filled track */
|
| 29 |
-
.stSlider > div[data-baseweb="slider"] > div > div:nth-child(2) {
|
| 30 |
-
background: transparent !important;
|
| 31 |
-
}
|
| 32 |
-
/* Optional: adjust track background to be subtle */
|
| 33 |
-
.stSlider > div[data-baseweb="slider"] > div > div:first-child {
|
| 34 |
-
background-color: #ccc !important;
|
| 35 |
-
}
|
| 36 |
-
</style>
|
| 37 |
-
""", unsafe_allow_html=True)
|
| 38 |
-
|
| 39 |
# Slider (starts at 0.5)
|
| 40 |
weight = st.slider("Interpolation Weight", 0.1, 0.9, 0.5, step=0.1)
|
| 41 |
|
| 42 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
filename_interp = f"videos_generated_{weight:.1f}.mp4"
|
| 44 |
filename_input1 = "videos_generated_0.0.mp4"
|
| 45 |
filename_input2 = "videos_generated_1.0.mp4"
|
| 46 |
|
| 47 |
-
# Full paths
|
| 48 |
video_interp = os.path.join(VIDEO_FOLDER, filename_interp)
|
| 49 |
video_input1 = os.path.join(VIDEO_FOLDER, filename_input1)
|
| 50 |
video_input2 = os.path.join(VIDEO_FOLDER, filename_input2)
|
| 51 |
|
| 52 |
-
# File checks
|
| 53 |
exists_interp = os.path.exists(video_interp)
|
| 54 |
exists_1 = os.path.exists(video_input1)
|
| 55 |
exists_2 = os.path.exists(video_input2)
|
| 56 |
|
| 57 |
-
#
|
| 58 |
-
if weight == 0.0:
|
| 59 |
-
st.success("Showing Input Video 1 (no interpolation)")
|
| 60 |
-
elif weight == 1.0:
|
| 61 |
-
st.success("Showing Input Video 2 (no interpolation)")
|
| 62 |
-
else:
|
| 63 |
-
w2 = round(1.0 - weight, 1)
|
| 64 |
-
st.info(
|
| 65 |
-
f"Generated motion: {weight:.1f} from Input Video 1 + {w2:.1f} from Input Video 2"
|
| 66 |
-
)
|
| 67 |
-
|
| 68 |
-
# Layout: 3 columns for videos
|
| 69 |
col1, col2, col3 = st.columns(3)
|
| 70 |
|
| 71 |
-
# Centered labels and video playback
|
| 72 |
with col1:
|
| 73 |
st.markdown("<div style='text-align: center; font-weight: bold;'>Input Video 1</div>", unsafe_allow_html=True)
|
| 74 |
if exists_1:
|
|
|
|
| 6 |
|
| 7 |
# Set page layout
|
| 8 |
st.set_page_config(layout="wide")
|
|
|
|
| 9 |
|
| 10 |
+
# Title and description (centered)
|
| 11 |
st.markdown("""
|
| 12 |
+
<h1 style="text-align: center;">AutoSynthDa Pose Interpolation Viewer</h1>
|
| 13 |
+
<h3 style="text-align: center;">AutoSynthDa Interpolation Viewer</h3>
|
| 14 |
+
<p style="text-align: center;">
|
| 15 |
+
AutoSynthDa blends two input motion videos to <strong>generate kinematically coherent, synthetic action videos</strong>.<br>
|
| 16 |
+
Use the slider below to explore how the system interpolates motion from one video to another.<br>
|
| 17 |
+
Source: <a href="https://github.com/nvidia/synthda" target="_blank">github.com/nvidia/synthda</a>
|
| 18 |
+
</p>
|
| 19 |
+
""", unsafe_allow_html=True)
|
| 20 |
|
| 21 |
+
# Slider instruction (centered)
|
| 22 |
st.markdown(
|
| 23 |
+
'<p style="text-align: center;"><strong>Use the slider to control the interpolation between Input Video 1 (left) and Input Video 2 (right).</strong></p>',
|
| 24 |
unsafe_allow_html=True
|
| 25 |
)
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
# Slider (starts at 0.5)
|
| 28 |
weight = st.slider("Interpolation Weight", 0.1, 0.9, 0.5, step=0.1)
|
| 29 |
|
| 30 |
+
# Interpolation explanation (centered)
|
| 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"Generated motion: {weight:.1f} from Input Video 1 + {w2:.1f} from Input Video 2"
|
| 38 |
+
|
| 39 |
+
st.markdown(f'<p style="text-align: center; color: #444;"><strong>{interp_text}</strong></p>', unsafe_allow_html=True)
|
| 40 |
+
|
| 41 |
+
# Filepaths
|
| 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, filename_input1)
|
| 48 |
video_input2 = os.path.join(VIDEO_FOLDER, filename_input2)
|
| 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 |
+
# Layout: 3 columns for video display
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
col1, col2, col3 = st.columns(3)
|
| 56 |
|
|
|
|
| 57 |
with col1:
|
| 58 |
st.markdown("<div style='text-align: center; font-weight: bold;'>Input Video 1</div>", unsafe_allow_html=True)
|
| 59 |
if exists_1:
|