Spaces:
Runtime error
Runtime error
Commit
·
e9fb38f
1
Parent(s):
ec9fd40
Update app.py
Browse files
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 |
-
#
|
| 6 |
-
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
frames = extract_frames(video)
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|
|
|
|
|
|