evelynsaltt commited on
Commit
3672275
·
verified ·
1 Parent(s): 4c72af5

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +52 -46
src/streamlit_app.py CHANGED
@@ -1,73 +1,59 @@
 
 
 
1
  import streamlit as st
2
  import os
3
 
4
  # Set your video directory here
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("""
11
- # AutoSynthDa Interpolation Viewer
12
 
13
  AutoSynthDa blends two input motion videos to **generate kinematically coherent, synthetic action videos**.
14
 
15
- Use the slider to view interpolated motion between two real motion capture inputs.
16
 
17
- View the code at: [github.com/nvidia/synthda](https://github.com/nvidia/synthda)
18
  """)
19
 
20
- # Custom styles for centering
21
- st.markdown("""
22
- <style>
23
- .centered-text {
24
- text-align: center;
25
- font-size: 18px;
26
- font-weight: 500;
27
- margin-top: 1em;
28
- margin-bottom: 1em;
29
- }
30
- .slider-label {
31
- text-align: center;
32
- font-size: 16px;
33
- color: gray;
34
- margin-bottom: 10px;
35
- }
36
- video {
37
- border-radius: 8px;
38
- box-shadow: 0 0 10px rgba(0,0,0,0.1);
39
- }
40
- </style>
41
- """, unsafe_allow_html=True)
42
-
43
- # Slider label
44
- st.markdown('<p class="slider-label">Slide to interpolate between Input Video 1 (left) and Input Video 2 (right)</p>', unsafe_allow_html=True)
45
-
46
- # Slider
47
  weight = st.slider("Interpolation Weight", 0.0, 1.0, step=0.1)
48
 
49
- # Calculate filenames
50
  filename_interp = f"videos_generated_{weight:.1f}.mp4"
 
 
 
51
  video_interp = os.path.join(VIDEO_FOLDER, filename_interp)
52
- video_input1 = os.path.join(VIDEO_FOLDER, "videos_generated_0.0.mp4")
53
- video_input2 = os.path.join(VIDEO_FOLDER, "videos_generated_1.0.mp4")
54
 
55
- # Display interpolation description
 
 
 
 
56
  if weight == 0.0:
57
- interp_text = "Showing Input Video 1 (Original)"
58
  elif weight == 1.0:
59
- interp_text = "Showing Input Video 2 (Original)"
60
  else:
61
  w2 = round(1.0 - weight, 1)
62
- interp_text = f"Interpolated Video: {weight:.1f} from Input 1 + {w2:.1f} from Input 2"
63
- st.markdown(f'<div class="centered-text">{interp_text}</div>', unsafe_allow_html=True)
64
-
65
- # Check files
66
- exists_1 = os.path.exists(video_input1)
67
- exists_interp = os.path.exists(video_interp)
68
- exists_2 = os.path.exists(video_input2)
69
 
70
- # Display videos side by side using columns
71
  col1, col2, col3 = st.columns(3)
72
 
73
  with col1:
@@ -78,4 +64,24 @@ with col1:
78
  <source src="{video_input1}" type="video/mp4">
79
  </video>""", unsafe_allow_html=True)
80
  else:
81
- st.error("Video 1 not fo
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import altair as alt
2
+ import numpy as np
3
+ import pandas as pd
4
  import streamlit as st
5
  import os
6
 
7
  # Set your video directory here
8
  VIDEO_FOLDER = "./src/synthda_falling_realreal/"
9
 
10
+ st.set_page_config(layout="wide")
11
  st.title("AutoSynthDa Pose Interpolation Viewer")
12
 
13
  st.markdown("""
14
+ ### AutoSynthDa Interpolation Viewer
15
 
16
  AutoSynthDa blends two input motion videos to **generate kinematically coherent, synthetic action videos**.
17
 
18
+ Use the slider below to explore how the system interpolates motion from one video to another.
19
 
20
+ Source: [github.com/nvidia/synthda](https://github.com/nvidia/synthda)
21
  """)
22
 
23
+ # Add slider explanation
24
+ st.markdown(
25
+ '<p style="text-align:center;"><strong>Move the slider to interpolate between Input Video 1 (left) and Input Video 2 (right)</strong></p>',
26
+ unsafe_allow_html=True
27
+ )
28
+
29
+ # Slider for selecting interpolation weight
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  weight = st.slider("Interpolation Weight", 0.0, 1.0, step=0.1)
31
 
32
+ # File paths
33
  filename_interp = f"videos_generated_{weight:.1f}.mp4"
34
+ filename_input1 = "videos_generated_0.0.mp4"
35
+ filename_input2 = "videos_generated_1.0.mp4"
36
+
37
  video_interp = os.path.join(VIDEO_FOLDER, filename_interp)
38
+ video_input1 = os.path.join(VIDEO_FOLDER, filename_input1)
39
+ video_input2 = os.path.join(VIDEO_FOLDER, filename_input2)
40
 
41
+ exists_interp = os.path.exists(video_interp)
42
+ exists_1 = os.path.exists(video_input1)
43
+ exists_2 = os.path.exists(video_input2)
44
+
45
+ # Description of blending
46
  if weight == 0.0:
47
+ st.success("Showing Input Video 1 (no interpolation)")
48
  elif weight == 1.0:
49
+ st.success("Showing Input Video 2 (no interpolation)")
50
  else:
51
  w2 = round(1.0 - weight, 1)
52
+ st.info(
53
+ f"Generated motion: {weight:.1f} from Input Video 1 + {w2:.1f} from Input Video 2"
54
+ )
 
 
 
 
55
 
56
+ # Show videos side by side
57
  col1, col2, col3 = st.columns(3)
58
 
59
  with col1:
 
64
  <source src="{video_input1}" type="video/mp4">
65
  </video>""", unsafe_allow_html=True)
66
  else:
67
+ st.error("Video 1 not found")
68
+
69
+ with col2:
70
+ st.markdown("**Interpolated Video**", unsafe_allow_html=True)
71
+ if exists_interp:
72
+ st.markdown(f"""
73
+ <video autoplay loop muted playsinline width="100%">
74
+ <source src="{video_interp}" type="video/mp4">
75
+ </video>""", unsafe_allow_html=True)
76
+ else:
77
+ st.error("Interpolated video not found")
78
+
79
+ with col3:
80
+ st.markdown("**Input Video 2**", unsafe_allow_html=True)
81
+ if exists_2:
82
+ st.markdown(f"""
83
+ <video autoplay loop muted playsinline width="100%">
84
+ <source src="{video_input2}" type="video/mp4">
85
+ </video>""", unsafe_allow_html=True)
86
+ else:
87
+ st.error("Video 2 not found")