Spaces:
Running
Running
testing purposes
Browse files- src/streamlit_app.py +12 -71
src/streamlit_app.py
CHANGED
|
@@ -4,79 +4,20 @@ import os
|
|
| 4 |
# Video directory
|
| 5 |
VIDEO_FOLDER = "./src/synthda_falling_realreal/"
|
| 6 |
|
| 7 |
-
|
| 8 |
-
st.
|
| 9 |
|
| 10 |
-
|
| 11 |
-
st.markdown("""
|
| 12 |
-
<h1 style="text-align: center;">Project SynthDa</h1>
|
| 13 |
-
<h3 style="text-align: center;">SynthDa Interpolation Demo 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
|
| 22 |
-
st.
|
| 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 |
-
#
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
if
|
| 32 |
-
|
| 33 |
-
elif weight == 1.0:
|
| 34 |
-
interp_text = "Showing Input Video 2 (no interpolation)"
|
| 35 |
else:
|
| 36 |
-
|
| 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("""
|
| 59 |
-
<div style='text-align: center; font-weight: bold;'>
|
| 60 |
-
Input Video 1 <span style="font-weight: normal;">(Generated with generative AI)</span>
|
| 61 |
-
</div>
|
| 62 |
-
""", unsafe_allow_html=True)
|
| 63 |
-
|
| 64 |
-
if exists_1:
|
| 65 |
-
st.video(video_input1)
|
| 66 |
-
else:
|
| 67 |
-
st.error("Video 1 not found")
|
| 68 |
-
|
| 69 |
-
with col2:
|
| 70 |
-
st.markdown("<div style='text-align: center; font-weight: bold;'>Interpolated Video</div>", unsafe_allow_html=True)
|
| 71 |
-
if exists_interp:
|
| 72 |
-
st.video(video_interp)
|
| 73 |
-
else:
|
| 74 |
-
st.error("Interpolated video not found")
|
| 75 |
-
|
| 76 |
-
with col3:
|
| 77 |
-
st.markdown("""<div style='text-align: center; font-weight: bold;'>Input Video 2 <span style="font-weight: normal;">(Obtained from real-world dataset)</span>
|
| 78 |
-
</div>""", unsafe_allow_html=True)
|
| 79 |
-
if exists_2:
|
| 80 |
-
st.video(video_input2)
|
| 81 |
-
else:
|
| 82 |
-
st.error("Video 2 not found")
|
|
|
|
| 4 |
# Video directory
|
| 5 |
VIDEO_FOLDER = "./src/synthda_falling_realreal/"
|
| 6 |
|
| 7 |
+
st.set_page_config(layout="centered")
|
| 8 |
+
st.title("AutoSynthDa Pose Interpolation Viewer")
|
| 9 |
|
| 10 |
+
st.markdown("Use the slider to explore how pose interpolation changes as the weight increases.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
# Slider for selecting weight
|
| 13 |
+
weight = st.slider("Interpolation Weight", 0.0, 1.0, step=0.1)
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# Filename based on slider value
|
| 16 |
+
filename = f"videos_generated_{weight:.1f}.mp4"
|
| 17 |
+
video_path = os.path.join(VIDEO_FOLDER, filename)
|
| 18 |
|
| 19 |
+
# If file exists, show video from static path
|
| 20 |
+
if os.path.exists(video_path):
|
| 21 |
+
st.video(f"{VIDEO_FOLDER}/{filename}")
|
|
|
|
|
|
|
| 22 |
else:
|
| 23 |
+
st.error(f"No video found for weight = {weight:.1f}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|