chaopro commited on
Commit
18b4eec
·
verified ·
1 Parent(s): cc3d01a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -18,11 +18,11 @@ with gr.Blocks() as demo:
18
  # 3. 输出视频
19
  result_video = gr.Video(label="去除字幕后的视频")
20
 
21
- def get_first_frame(video):
22
- frame = extract_frame(video, 10) # 默认取第10帧,避免片头字幕
23
  return Image.fromarray(frame) if frame is not None else None
24
 
25
- video_input.change(fn=get_first_frame, inputs=video_input, outputs=frame_output)
26
 
27
  run_btn = gr.Button("去除字幕")
28
  run_btn.click(fn=remove_subtitles, inputs=[video_input, x1, y1, x2, y2], outputs=result_video)
 
18
  # 3. 输出视频
19
  result_video = gr.Video(label="去除字幕后的视频")
20
 
21
+ def get_frame(video):
22
+ frame = extract_frame(video, 10) # 默认取第10帧
23
  return Image.fromarray(frame) if frame is not None else None
24
 
25
+ video_input.change(fn=get_frame, inputs=video_input, outputs=frame_output)
26
 
27
  run_btn = gr.Button("去除字幕")
28
  run_btn.click(fn=remove_subtitles, inputs=[video_input, x1, y1, x2, y2], outputs=result_video)