Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import os | |
| # Video directories | |
| VIDEO_FOLDER_1 = "./src/synthda_falling_realreal/" | |
| VIDEO_FOLDER_2 = "./src/synthda_demo_fall_2/" | |
| VIDEO_FOLDER_3 = "./src/synthda_demo_fall_3/" # NEW | |
| # Set page layout | |
| st.set_page_config(layout="wide") | |
| # Title and description (centered) | |
| st.markdown(""" | |
| <h1 style="text-align: center;">Project SynthDa</h1> | |
| <h3 style="text-align: center;">SynthDa Interpolation Demo Viewer</h3> | |
| <p style="text-align: center;"> | |
| AutoSynthDa blends two input motion videos to <strong>generate kinematically coherent, synthetic action videos</strong>.<br> | |
| Use the sliders below to explore how the system interpolates motion from one video to another.<br> | |
| Source: <a href="https://github.com/nvidia/synthda" target="_blank">github.com/nvidia/synthda</a> | |
| </p> | |
| """, unsafe_allow_html=True) | |
| # ---------- Row 1: synthda_falling_realreal ---------- | |
| st.markdown("## Demo Set 1: Synthetic-Real Interpolation [Fall]") | |
| weight1 = st.slider("Interpolation Weight (Set 1)", 0.0, 1.0, 0.5, step=0.1) | |
| if weight1 == 0.0: | |
| interp_text1 = "Showing Input Video 1 (no interpolation)" | |
| elif weight1 == 1.0: | |
| interp_text1 = "Showing Input Video 2 (no interpolation)" | |
| else: | |
| w2 = round(1.0 - weight1, 1) | |
| interp_text1 = f"Generated motion: {weight1:.1f} from Input Video 1 + {w2:.1f} from Input Video 2" | |
| st.markdown(f"**{interp_text1}**") | |
| filename_interp = f"videos_generated_{weight1:.1f}.mp4" | |
| filename_input1 = "videos_generated_0.0.mp4" | |
| filename_input2 = "videos_generated_1.0.mp4" | |
| video_interp = os.path.join(VIDEO_FOLDER_1, filename_interp) | |
| video_input1 = os.path.join(VIDEO_FOLDER_1, filename_input1) | |
| video_input2 = os.path.join(VIDEO_FOLDER_1, filename_input2) | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| st.markdown("**Input Video 1 (Generated)**") | |
| if os.path.exists(video_input1): | |
| st.video(video_input1) | |
| else: | |
| st.error("Video 1 not found") | |
| with col2: | |
| st.markdown("**Interpolated Video**") | |
| if os.path.exists(video_interp): | |
| st.video(video_interp) | |
| else: | |
| st.error("Interpolated video not found") | |
| with col3: | |
| st.markdown("**Input Video 2 (Real)**") | |
| if os.path.exists(video_input2): | |
| st.video(video_input2) | |
| else: | |
| st.error("Video 2 not found") | |
| # ---------- Row 2: synthda_demo_fall_2 ---------- | |
| st.markdown("## Demo Set 2: Real-Real Interpolation [Fall]") | |
| weight2 = st.slider("Interpolation Weight (Set 2)", 0.0, 1.0, 0.5, step=0.1) | |
| if weight2 == 0.0: | |
| interp_text2 = "Showing Input Video 1 (no interpolation)" | |
| elif weight2 == 1.0: | |
| interp_text2 = "Showing Input Video 2 (no interpolation)" | |
| else: | |
| w2 = round(1.0 - weight2, 1) | |
| interp_text2 = f"Generated motion: {weight2:.1f} from Input Video 1 + {w2:.1f} from Input Video 2" | |
| st.markdown(f"**{interp_text2}**") | |
| filename_interp2 = f"videos_generated_{weight2:.1f}.mp4" | |
| filename_input1_2 = "videos_generated_0.0.mp4" | |
| filename_input2_2 = "videos_generated_1.0.mp4" | |
| video_interp2 = os.path.join(VIDEO_FOLDER_2, filename_interp2) | |
| video_input1_2 = os.path.join(VIDEO_FOLDER_2, filename_input1_2) | |
| video_input2_2 = os.path.join(VIDEO_FOLDER_2, filename_input2_2) | |
| col4, col5, col6 = st.columns(3) | |
| with col4: | |
| st.markdown("**Input Video 1 (Generated)**") | |
| if os.path.exists(video_input1_2): | |
| st.video(video_input1_2) | |
| else: | |
| st.error("Video 1 not found") | |
| with col5: | |
| st.markdown("**Interpolated Video**") | |
| if os.path.exists(video_interp2): | |
| st.video(video_interp2) | |
| else: | |
| st.error("Interpolated video not found") | |
| with col6: | |
| st.markdown("**Input Video 2 (Real)**") | |
| if os.path.exists(video_input2_2): | |
| st.video(video_input2_2) | |
| else: | |
| st.error("Video 2 not found") | |
| # ---------- Row 3: synthda_demo_fall_3 (NEW) ---------- | |
| st.markdown("## Demo Set 3: Real-Real Interpolation [Fall][Different Lighting/BG]") | |
| weight3 = st.slider("Interpolation Weight (Set 3)", 0.0, 1.0, 0.5, step=0.1) | |
| if weight3 == 0.0: | |
| interp_text3 = "Showing Input Video 1 (no interpolation)" | |
| elif weight3 == 1.0: | |
| interp_text3 = "Showing Input Video 2 (no interpolation)" | |
| else: | |
| w2 = round(1.0 - weight3, 1) | |
| interp_text3 = f"Generated motion: {weight3:.1f} from Input Video 1 + {w2:.1f} from Input Video 2" | |
| st.markdown(f"**{interp_text3}**") | |
| filename_interp3 = f"videos_generated_{weight3:.1f}.mp4" | |
| filename_input1_3 = "videos_generated_0.0.mp4" | |
| filename_input2_3 = "videos_generated_1.0.mp4" | |
| video_interp3 = os.path.join(VIDEO_FOLDER_3, filename_interp3) | |
| video_input1_3 = os.path.join(VIDEO_FOLDER_3, filename_input1_3) | |
| video_input2_3 = os.path.join(VIDEO_FOLDER_3, filename_input2_3) | |
| col7, col8, col9 = st.columns(3) | |
| with col7: | |
| st.markdown("**Input Video 1 (Generated)**") | |
| if os.path.exists(video_input1_3): | |
| st.video(video_input1_3) | |
| else: | |
| st.error("Video 1 not found") | |
| with col8: | |
| st.markdown("**Interpolated Video**") | |
| if os.path.exists(video_interp3): | |
| st.video(video_interp3) | |
| else: | |
| st.error("Interpolated video not found") | |
| with col9: | |
| st.markdown("**Input Video 2 (Real)**") | |
| if os.path.exists(video_input2_3): | |
| st.video(video_input2_3) | |
| else: | |
| st.error("Video 2 not found") |