Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import tempfile | |
| import os | |
| from utils.video_utils import extract_frames | |
| from utils.depth_utils import estimate_depth | |
| from utils.pointcloud_utils import depth_to_pointcloud | |
| def video_to_3d(video): | |
| with tempfile.TemporaryDirectory() as tmpdir: | |
| video_path = os.path.join(tmpdir, "input.mp4") | |
| os.rename(video, video_path) | |
| frames = extract_frames(video_path, tmpdir) | |
| depth_maps = estimate_depth(frames) | |
| ply_path = depth_to_pointcloud(depth_maps, frames, tmpdir) | |
| return ply_path | |
| demo = gr.Interface( | |
| fn=video_to_3d, | |
| inputs=gr.Video(label="Upload Object Video"), | |
| outputs=gr.File(label="Download 3D Model (.ply)"), | |
| title="🎥 Video to 3D Model Generator", | |
| description="Upload a short 360° video of an object to generate a 3D point cloud." | |
| ) | |
| demo.launch() | |