import streamlit as st import os import nerf import torch # Check if the directory called Model exists if not os.path.exists("Model"): # Create the directory os.mkdir("Model") # Check if the model is downloaded if not os.path.exists("Model/nerf_model.ckpt"): # Download the model wget https://github.com/bmild/nerf/releases/download/v0.5/nerf_model.ckpt # Load the NeRF model nerf_model = nerf.NeRF.load("Model/nerf_model.ckpt") # Define the camera parameters camera = nerf.Camera( fov=60, focal_length=50, znear=1, zfar=100, principal_point=(0.5, 0.5), ) # Define the viewing direction viewing_direction = torch.tensor([0, 0, 1]) # Render the novel view novel_view = nerf_model.render(viewing_direction, camera) # Save the novel view torch.save(novel_view, "novel_view.png") # Create a Streamlit app st.title("NeRF with Dolly Zoom") # Show the image st.image("novel_view.png")