fffiloni's picture
Update app.py
68a5c33
raw
history blame
674 Bytes
import gradio as gr
from scenedetect import SceneManager, open_video, ContentDetector
def find_scenes(video_path, threshold=27.0):
video = open_video(video_path)
scene_manager = SceneManager()
scene_manager.add_detector(
ContentDetector(threshold=threshold))
# Detect all scenes in video from current position to end.
scene_manager.detect_scenes(video)
# `get_scene_list` returns a list of start/end timecode pairs
# for each scene that was found.
return scene_manager.get_scene_list()
video_input=gr.Video(source="upload", format="mp4", mirror_webcam="False");
gr.Interface(fn=find_scenes, inputs=video_input, outputs="json").launch()