Update app.py
Browse files
app.py
CHANGED
|
@@ -18,11 +18,11 @@ with gr.Blocks() as demo:
|
|
| 18 |
# 3. 输出视频
|
| 19 |
result_video = gr.Video(label="去除字幕后的视频")
|
| 20 |
|
| 21 |
-
def
|
| 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=
|
| 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)
|