Spaces:
Runtime error
Runtime error
envs
Browse files
app.py
CHANGED
@@ -304,10 +304,6 @@ class ImageConductor:
|
|
304 |
id = base.split('_')[-1]
|
305 |
|
306 |
|
307 |
-
# with open(f'{output_dir}/points-{id}.json', 'w') as f:
|
308 |
-
# json.dump(input_all_points, f)
|
309 |
-
|
310 |
-
|
311 |
visualized_drag, _ = visualize_drag(first_frame_path, resized_all_points, drag_mode, self.width, self.height, self.model_length)
|
312 |
|
313 |
## image condition
|
@@ -401,7 +397,7 @@ def preprocess_image(image, tracking_points):
|
|
401 |
id = str(uuid.uuid4())[:4]
|
402 |
first_frame_path = os.path.join(output_dir, f"first_frame_{id}.jpg")
|
403 |
image_pil.save(first_frame_path, quality=95)
|
404 |
-
return {input_image: first_frame_path, first_frame_path_var: first_frame_path, tracking_points_var: tracking_points}
|
405 |
|
406 |
|
407 |
def add_tracking_points(tracking_points, first_frame_path, drag_mode, evt: gr.SelectData): # SelectData is a subclass of EventData
|
@@ -414,6 +410,7 @@ def add_tracking_points(tracking_points, first_frame_path, drag_mode, evt: gr.Se
|
|
414 |
tracking_points[-1].append(evt.index)
|
415 |
print(tracking_points)
|
416 |
|
|
|
417 |
transparent_background = Image.open(first_frame_path).convert('RGBA')
|
418 |
w, h = transparent_background.size
|
419 |
transparent_layer = np.zeros((h, w, 4))
|
@@ -626,7 +623,7 @@ if __name__=="__main__":
|
|
626 |
gr.Markdown(citation)
|
627 |
|
628 |
|
629 |
-
image_upload_button.upload(preprocess_image, [image_upload_button, tracking_points_var], [input_image, first_frame_path_var, tracking_points_var])
|
630 |
|
631 |
add_drag_button.click(add_drag, [tracking_points_var], tracking_points_var)
|
632 |
|
|
|
304 |
id = base.split('_')[-1]
|
305 |
|
306 |
|
|
|
|
|
|
|
|
|
307 |
visualized_drag, _ = visualize_drag(first_frame_path, resized_all_points, drag_mode, self.width, self.height, self.model_length)
|
308 |
|
309 |
## image condition
|
|
|
397 |
id = str(uuid.uuid4())[:4]
|
398 |
first_frame_path = os.path.join(output_dir, f"first_frame_{id}.jpg")
|
399 |
image_pil.save(first_frame_path, quality=95)
|
400 |
+
return {input_image: first_frame_path, output_image: None, output_video:None, first_frame_path_var: first_frame_path, tracking_points_var: tracking_points}
|
401 |
|
402 |
|
403 |
def add_tracking_points(tracking_points, first_frame_path, drag_mode, evt: gr.SelectData): # SelectData is a subclass of EventData
|
|
|
410 |
tracking_points[-1].append(evt.index)
|
411 |
print(tracking_points)
|
412 |
|
413 |
+
print("first_frame_path", first_frame_path)
|
414 |
transparent_background = Image.open(first_frame_path).convert('RGBA')
|
415 |
w, h = transparent_background.size
|
416 |
transparent_layer = np.zeros((h, w, 4))
|
|
|
623 |
gr.Markdown(citation)
|
624 |
|
625 |
|
626 |
+
image_upload_button.upload(preprocess_image, [image_upload_button, tracking_points_var], [input_image, output_image, output_video, first_frame_path_var, tracking_points_var])
|
627 |
|
628 |
add_drag_button.click(add_drag, [tracking_points_var], tracking_points_var)
|
629 |
|