vinesnt commited on
Commit
45ace3f
·
verified ·
1 Parent(s): 405de0f

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -864,7 +864,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS, delete_cache=(3600, 10800)) as d
864
  visible=False,
865
  )
866
  with gr.Group(visible=False) as v2v_mask_tools:
867
- first_frame_display = gr.Image(label="第一帧预览 / First Frame (点击标记区域)", type="pil", interactive=False)
868
  points_store = gr.State(value=[])
869
  points_display = gr.Textbox(label="标记点 / Points", value="无标记 / No points", interactive=False)
870
  with gr.Row():
@@ -947,7 +947,9 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS, delete_cache=(3600, 10800)) as d
947
  if img is None:
948
  return img, points, "请先提取第一帧 / Extract first frame first"
949
  x, y = evt.index
 
950
  label = 1 if "include" in mode else 0
 
951
  points.append({"x": x, "y": y, "label": label})
952
  # Draw points on image
953
  display_img = img.copy()
@@ -968,6 +970,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS, delete_cache=(3600, 10800)) as d
968
 
969
  def on_generate_mask(video, points):
970
  import json
 
971
  vpath = extract_video_path(video)
972
  if not vpath:
973
  raise gr.Error("请先上传视频 / Upload video first")
 
864
  visible=False,
865
  )
866
  with gr.Group(visible=False) as v2v_mask_tools:
867
+ first_frame_display = gr.Image(label="第一帧预览 / First Frame (点击标记区域)", type="pil", interactive=True)
868
  points_store = gr.State(value=[])
869
  points_display = gr.Textbox(label="标记点 / Points", value="无标记 / No points", interactive=False)
870
  with gr.Row():
 
947
  if img is None:
948
  return img, points, "请先提取第一帧 / Extract first frame first"
949
  x, y = evt.index
950
+ print(f"[DEBUG] Click at ({x}, {y}), mode={mode}, total_points={len(points)+1}")
951
  label = 1 if "include" in mode else 0
952
+ points = list(points) if points else [] # ensure mutable copy
953
  points.append({"x": x, "y": y, "label": label})
954
  # Draw points on image
955
  display_img = img.copy()
 
970
 
971
  def on_generate_mask(video, points):
972
  import json
973
+ print(f"[DEBUG] on_generate_mask called, points type={type(points)}, value={points}")
974
  vpath = extract_video_path(video)
975
  if not vpath:
976
  raise gr.Error("请先上传视频 / Upload video first")