Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -157,9 +157,11 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
|
|
157 |
# out.write(combined_frame)
|
158 |
# frame_path = os.path.join(temp_frame_dir, f"frame_{count:05d}.png")
|
159 |
# cv2.imwrite(frame_path, combined_frame)
|
160 |
-
|
161 |
cv2.imwrite(f"f{count}.jpg", raw_frame)
|
162 |
orig_frames.append(f"f{count}.jpg")
|
|
|
|
|
163 |
cv2.imwrite(f"f{count}_dmap.jpg", depth_color)
|
164 |
depth_frames.append(f"f{count}_dmap.jpg")
|
165 |
count += 1
|
@@ -171,12 +173,10 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
|
|
171 |
cv2.destroyAllWindows()
|
172 |
|
173 |
global frame_selected
|
174 |
-
global masks
|
175 |
global depths
|
176 |
global frames
|
177 |
frames = orig_frames
|
178 |
depths = depth_frames
|
179 |
-
masks = orig_frames
|
180 |
return final_vid, final_zip, frames, masks[frame_selected] #output_path
|
181 |
|
182 |
def depth_edges_mask(depth):
|
@@ -379,7 +379,7 @@ with gr.Blocks(css=css) as demo:
|
|
379 |
input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
|
380 |
input_video = gr.Video(label="Input Video", format="mp4")
|
381 |
input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
|
382 |
-
output_frame = gr.Gallery(label="Frames", preview=True, columns=8192)
|
383 |
output_switch = gr.Checkbox(label="Show depths")
|
384 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
385 |
output_mask = gr.ImageEditor(interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(colors=['black', 'darkgray', 'gray', 'lightgray', 'white']), layers=True)
|
|
|
157 |
# out.write(combined_frame)
|
158 |
# frame_path = os.path.join(temp_frame_dir, f"frame_{count:05d}.png")
|
159 |
# cv2.imwrite(frame_path, combined_frame)
|
160 |
+
|
161 |
cv2.imwrite(f"f{count}.jpg", raw_frame)
|
162 |
orig_frames.append(f"f{count}.jpg")
|
163 |
+
global masks
|
164 |
+
masks.append(f"f{count}.jpg")
|
165 |
cv2.imwrite(f"f{count}_dmap.jpg", depth_color)
|
166 |
depth_frames.append(f"f{count}_dmap.jpg")
|
167 |
count += 1
|
|
|
173 |
cv2.destroyAllWindows()
|
174 |
|
175 |
global frame_selected
|
|
|
176 |
global depths
|
177 |
global frames
|
178 |
frames = orig_frames
|
179 |
depths = depth_frames
|
|
|
180 |
return final_vid, final_zip, frames, masks[frame_selected] #output_path
|
181 |
|
182 |
def depth_edges_mask(depth):
|
|
|
379 |
input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
|
380 |
input_video = gr.Video(label="Input Video", format="mp4")
|
381 |
input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
|
382 |
+
output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="filepath")
|
383 |
output_switch = gr.Checkbox(label="Show depths")
|
384 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
385 |
output_mask = gr.ImageEditor(interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(colors=['black', 'darkgray', 'gray', 'lightgray', 'white']), layers=True)
|