Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikram Voleti committed Jul 23, 2024
1 parent 0ebca5c commit c4a9d1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions scripts/demo/sv3d_p_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@
num_steps,
)

polars_rad = np.array([np.deg2rad(90 - 10.0)] * num_frames)
azimuths_rad = np.linspace(0, 2 * np.pi, num_frames + 1)[1:]


def gen_orbit(orbit, elev_deg):
global polars_rad
global azimuths_rad
if orbit == "dynamic":
azim_rad, elev_rad = gen_dynamic_loop(length=num_frames, elev_deg=elev_deg)
polars_rad = np.deg2rad(90) - elev_rad
Expand All @@ -82,8 +83,6 @@ def sample(
input_path: str = "assets/test_image.png", # Can either be image file or folder with image files
seed: Optional[int] = None,
randomize_seed: bool = True,
orbit: str = "same elevation",
elev_deg: float = 10.0,
decoding_t: int = 7, # Number of frames decoded at a time! This eats most VRAM. Reduce if necessary.
device: str = "cuda",
output_folder: str = None,
Expand Down Expand Up @@ -292,18 +291,18 @@ def resize_image(image_path, output_size=(576, 576)):
video = gr.Video()
with gr.Row():
with gr.Column():
orbit = gr.Dropdown(
["same elevation", "dynamic"],
label="Orbit",
info="Choose with orbit to generate",
)
elev_deg = gr.Slider(
label="Elevation (in degrees)",
info="Elevation of the camera in the conditioning image, in degrees.",
value=10.0,
minimum=-10,
maximum=30,
)
orbit = gr.Dropdown(
["same elevation", "dynamic"],
label="Orbit",
info="Choose with orbit to generate",
)
plot_image = gr.Image()
with gr.Accordion("Advanced options", open=False):
seed = gr.Slider(
Expand All @@ -325,8 +324,8 @@ def resize_image(image_path, output_size=(576, 576)):

image.upload(fn=resize_image, inputs=image, outputs=image, queue=False)

elev_deg.change(gen_orbit, [orbit, elev_deg], plot_image)
orbit.change(gen_orbit, [orbit, elev_deg], plot_image)
elev_deg.change(gen_orbit, [orbit, elev_deg], plot_image)
# seed.change(gen_orbit, [orbit, elev_deg], plot_image)

generate_btn.click(
Expand Down
2 changes: 1 addition & 1 deletion scripts/demo/sv3d_u_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import sys

sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
sys.path.append(os.path.dirname(__file__))

import random
from glob import glob
Expand Down

0 comments on commit c4a9d1f

Please sign in to comment.