Spaces:
Build error
Build error
import streamlit as st | |
import os | |
# Set your video directory here | |
VIDEO_FOLDER = "./src/synthda_falling_realreal/" | |
st.set_page_config(layout="centered") | |
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 to view interpolated motion between two real motion capture inputs. | |
View the code at: [github.com/nvidia/synthda](https://github.com/nvidia/synthda) | |
""") | |
# Custom styles for centering | |
st.markdown(""" | |
<style> | |
.centered-text { | |
text-align: center; | |
font-size: 18px; | |
font-weight: 500; | |
margin-top: 1em; | |
margin-bottom: 1em; | |
} | |
.slider-label { | |
text-align: center; | |
font-size: 16px; | |
color: gray; | |
margin-bottom: 10px; | |
} | |
video { | |
border-radius: 8px; | |
box-shadow: 0 0 10px rgba(0,0,0,0.1); | |
} | |
</style> | |
""", unsafe_allow_html=True) | |
# Slider label | |
st.markdown('<p class="slider-label">Slide to interpolate between Input Video 1 (left) and Input Video 2 (right)</p>', unsafe_allow_html=True) | |
# Slider | |
weight = st.slider("Interpolation Weight", 0.0, 1.0, step=0.1) | |
# Calculate filenames | |
filename_interp = f"videos_generated_{weight:.1f}.mp4" | |
video_interp = os.path.join(VIDEO_FOLDER, filename_interp) | |
video_input1 = os.path.join(VIDEO_FOLDER, "videos_generated_0.0.mp4") | |
video_input2 = os.path.join(VIDEO_FOLDER, "videos_generated_1.0.mp4") | |
# Display interpolation description | |
if weight == 0.0: | |
interp_text = "Showing Input Video 1 (Original)" | |
elif weight == 1.0: | |
interp_text = "Showing Input Video 2 (Original)" | |
else: | |
w2 = round(1.0 - weight, 1) | |
interp_text = f"Interpolated Video: {weight:.1f} from Input 1 + {w2:.1f} from Input 2" | |
st.markdown(f'<div class="centered-text">{interp_text}</div>', unsafe_allow_html=True) | |
# Check files | |
exists_1 = os.path.exists(video_input1) | |
exists_interp = os.path.exists(video_interp) | |
exists_2 = os.path.exists(video_input2) | |
# Display videos side by side using columns | |
col1, col2, col3 = st.columns(3) | |
with col1: | |
st.markdown("**Input Video 1**", unsafe_allow_html=True) | |
if exists_1: | |
st.markdown(f""" | |
<video autoplay loop muted playsinline width="100%"> | |
<source src="{video_input1}" type="video/mp4"> | |
</video>""", unsafe_allow_html=True) | |
else: | |
st.error("Video 1 not fo | |