Spaces:
Running
Running
import streamlit as st | |
import os | |
# Video directory | |
VIDEO_FOLDER = "./src/synthda_falling_realreal/" | |
# Set page layout | |
st.set_page_config(layout="wide") | |
st.title("AutoSynthDa Pose Interpolation Viewer") | |
st.markdown(""" | |
### AutoSynthDa Interpolation Viewer | |
AutoSynthDa blends two input motion videos to **generate kinematically coherent, synthetic action videos**. | |
Use the slider below to explore how the system interpolates motion from one video to another. | |
Source: [github.com/nvidia/synthda](https://github.com/nvidia/synthda) | |
""") | |
# Slider instruction | |
st.markdown( | |
'<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>', | |
unsafe_allow_html=True | |
) | |
# Hide the orange filled track of the slider | |
st.markdown(""" | |
<style> | |
/* Hide the filled track */ | |
.stSlider > div[data-baseweb="slider"] > div > div:nth-child(2) { | |
background: transparent !important; | |
} | |
/* Optional: adjust track background to be subtle */ | |
.stSlider > div[data-baseweb="slider"] > div > div:first-child { | |
background-color: #ccc !important; | |
} | |
</style> | |
""", unsafe_allow_html=True) | |
# Slider (starts at 0.5) | |
weight = st.slider("Interpolation Weight", 0.1, 0.9, 0.5, step=0.1) | |
# Filenames | |
filename_interp = f"videos_generated_{weight:.1f}.mp4" | |
filename_input1 = "videos_generated_0.0.mp4" | |
filename_input2 = "videos_generated_1.0.mp4" | |
# Full paths | |
video_interp = os.path.join(VIDEO_FOLDER, filename_interp) | |
video_input1 = os.path.join(VIDEO_FOLDER, filename_input1) | |
video_input2 = os.path.join(VIDEO_FOLDER, filename_input2) | |
# File checks | |
exists_interp = os.path.exists(video_interp) | |
exists_1 = os.path.exists(video_input1) | |
exists_2 = os.path.exists(video_input2) | |
# Interpolation status | |
if weight == 0.0: | |
st.success("Showing Input Video 1 (no interpolation)") | |
elif weight == 1.0: | |
st.success("Showing Input Video 2 (no interpolation)") | |
else: | |
w2 = round(1.0 - weight, 1) | |
st.info( | |
f"Generated motion: {weight:.1f} from Input Video 1 + {w2:.1f} from Input Video 2" | |
) | |
# Layout: 3 columns for videos | |
col1, col2, col3 = st.columns(3) | |
# Centered labels and video playback | |
with col1: | |
st.markdown("<div style='text-align: center; font-weight: bold;'>Input Video 1</div>", unsafe_allow_html=True) | |
if exists_1: | |
st.video(video_input1) | |
else: | |
st.error("Video 1 not found") | |
with col2: | |
st.markdown("<div style='text-align: center; font-weight: bold;'>Interpolated Video</div>", unsafe_allow_html=True) | |
if exists_interp: | |
st.video(video_interp) | |
else: | |
st.error("Interpolated video not found") | |
with col3: | |
st.markdown("<div style='text-align: center; font-weight: bold;'>Input Video 2</div>", unsafe_allow_html=True) | |
if exists_2: | |
st.video(video_input2) | |
else: | |
st.error("Video 2 not found") | |