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

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +36 -24
src/streamlit_app.py CHANGED
@@ -1,6 +1,3 @@
1
- import altair as alt
2
- import numpy as np
3
- import pandas as pd
4
  import streamlit as st
5
  import os
6
 
@@ -10,18 +7,17 @@ VIDEO_FOLDER = "./src/synthda_falling_realreal/"
10
  st.set_page_config(layout="centered")
11
  st.title("AutoSynthDa Pose Interpolation Viewer")
12
 
13
- # Project description
14
  st.markdown("""
15
  # AutoSynthDa Interpolation Viewer
16
 
17
  AutoSynthDa blends two input motion videos to **generate kinematically coherent, synthetic action videos**.
18
 
19
- Move the slider to explore how motion changes from one input to another.
20
 
21
- View code and try the code on Colab at github.com/nvidia/synthda
22
  """)
23
 
24
- # Custom CSS for styling
25
  st.markdown("""
26
  <style>
27
  .centered-text {
@@ -37,33 +33,49 @@ st.markdown("""
37
  color: gray;
38
  margin-bottom: 10px;
39
  }
 
 
 
 
40
  </style>
41
  """, unsafe_allow_html=True)
42
 
43
- # Slider explanation
44
- st.markdown('<p class="slider-label">Move the slider to interpolate between Input Video 1 (0.0) and Input Video 2 (1.0)</p>', unsafe_allow_html=True)
45
 
46
- # Slider for selecting weight
47
  weight = st.slider("Interpolation Weight", 0.0, 1.0, step=0.1)
48
 
49
- # Construct filename based on weight
50
- filename = f"videos_generated_{weight:.1f}.mp4"
51
- video_path = os.path.join(VIDEO_FOLDER, filename)
 
 
52
 
53
- # Interpolation description
54
  if weight == 0.0:
55
- interp_text = "Showing: Input Video 1 (Original)"
56
  elif weight == 1.0:
57
- interp_text = "Showing: Input Video 2 (Original)"
58
  else:
59
  w2 = round(1.0 - weight, 1)
60
- interp_text = f"Generated video: {weight:.1f} from Input Video 1 + {w2:.1f} from Input Video 2"
61
-
62
- # Display the interpolation status
63
  st.markdown(f'<div class="centered-text">{interp_text}</div>', unsafe_allow_html=True)
64
 
65
- # Show video
66
- if os.path.exists(video_path):
67
- st.video(video_path)
68
- else:
69
- st.error(f"No video found for weight = {weight:.1f}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import os
3
 
 
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 {
 
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:
74
+ st.markdown("**Input Video 1**", unsafe_allow_html=True)
75
+ if exists_1:
76
+ st.markdown(f"""
77
+ <video autoplay loop muted playsinline width="100%">
78
+ <source src="{video_input1}" type="video/mp4">
79
+ </video>""", unsafe_allow_html=True)
80
+ else:
81
+ st.error("Video 1 not fo