Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -148,7 +148,6 @@ def segment_frame(evt: gr.SelectData, label, video_state):
|
|
| 148 |
|
| 149 |
return Image.fromarray(painted_image)
|
| 150 |
|
| 151 |
-
@spaces.GPU(duration=10)
|
| 152 |
def clear_clicks(video_state):
|
| 153 |
video_state["input_points"] = []
|
| 154 |
video_state["input_labels"] = []
|
|
@@ -180,6 +179,7 @@ def preprocess_for_removal(images, masks):
|
|
| 180 |
arr_masks = np.stack(out_masks)
|
| 181 |
return torch.from_numpy(arr_images).half().to(device), torch.from_numpy(arr_masks).half().to(device)
|
| 182 |
|
|
|
|
| 183 |
def inference_and_return_video(dilation_iterations, num_inference_steps, video_state=None):
|
| 184 |
if video_state["origin_images"] is None or video_state["masks"] is None:
|
| 185 |
return None
|
|
@@ -218,6 +218,7 @@ def inference_and_return_video(dilation_iterations, num_inference_steps, video_s
|
|
| 218 |
clip.write_videofile(video_file, codec='libx264', audio=False, verbose=False, logger=None)
|
| 219 |
return video_file
|
| 220 |
|
|
|
|
| 221 |
def track_video(n_frames, video_state):
|
| 222 |
|
| 223 |
input_points = video_state["input_points"]
|
|
|
|
| 148 |
|
| 149 |
return Image.fromarray(painted_image)
|
| 150 |
|
|
|
|
| 151 |
def clear_clicks(video_state):
|
| 152 |
video_state["input_points"] = []
|
| 153 |
video_state["input_labels"] = []
|
|
|
|
| 179 |
arr_masks = np.stack(out_masks)
|
| 180 |
return torch.from_numpy(arr_images).half().to(device), torch.from_numpy(arr_masks).half().to(device)
|
| 181 |
|
| 182 |
+
@spaces.GPU(duration=200)
|
| 183 |
def inference_and_return_video(dilation_iterations, num_inference_steps, video_state=None):
|
| 184 |
if video_state["origin_images"] is None or video_state["masks"] is None:
|
| 185 |
return None
|
|
|
|
| 218 |
clip.write_videofile(video_file, codec='libx264', audio=False, verbose=False, logger=None)
|
| 219 |
return video_file
|
| 220 |
|
| 221 |
+
@spaces.GPU(duration=60)
|
| 222 |
def track_video(n_frames, video_state):
|
| 223 |
|
| 224 |
input_points = video_state["input_points"]
|