Jackoabaad commited on
Commit
e9fb38f
·
1 Parent(s): ec9fd40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -13
app.py CHANGED
@@ -1,22 +1,32 @@
 
1
  import torch
2
  import torchvision.transforms as transforms
3
  from easymocap.apps.neuralbody import demo
4
 
5
- # Get the embed code for the YouTube video
6
- embed_code = get_embed_code("vjBrN18wiuE")
7
 
8
- # Download the video and extract the frames
9
- video = download_video(embed_code)
10
- frames = extract_frames(video)
11
 
12
- # Convert the frames to tensors
13
- frames = torch.from_numpy(frames).float()
 
 
 
14
 
15
- # Create a 3D scene from the frames
16
- scene = create_scene(frames)
17
 
18
- # Use view synthesis to render a novel view of the scene
19
- novel_view = render_novel_view(scene)
 
 
 
 
 
 
 
 
 
20
 
21
- # Save the novel view
22
- save_image(novel_view, "novel_view.png")
 
1
+ import streamlit as st
2
  import torch
3
  import torchvision.transforms as transforms
4
  from easymocap.apps.neuralbody import demo
5
 
6
+ # Create a text box to enter the YouTube video ID
7
+ video_id = st.text_input("Enter the YouTube video ID:")
8
 
9
+ # Create a progress bar
10
+ progress_bar = st.progress(0)
 
11
 
12
+ # If the user enters a valid YouTube video ID, download the video and extract the frames
13
+ if video_id:
14
+ embed_code = get_embed_code(video_id)
15
+ video = download_video(embed_code)
16
+ frames = extract_frames(video)
17
 
18
+ # Convert the frames to tensors
19
+ frames = torch.from_numpy(frames).float()
20
 
21
+ # Create a 3D scene from the frames
22
+ scene = create_scene(frames)
23
+
24
+ # Use view synthesis to render a novel view of the scene
25
+ novel_view = render_novel_view(scene)
26
+
27
+ # Update the progress bar
28
+ progress_bar.progress(100)
29
+
30
+ # Show the novel view
31
+ st.image(novel_view)
32