File size: 466 Bytes
59d3dd1
0f220e9
 
59d3dd1
0f220e9
 
 
 
 
 
59d3dd1
0f220e9
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
import utils
from config import KINETICS_600_LABELS, MODEL

def get_predictions(video_path):
    video, frame_list = utils.preprocess_video(video_path)
    model = MODEL
    probs = model(video)
    labels = utils.get_top_k(probs, label_map=KINETICS_600_LABELS)
    return labels

label = gr.components.Label(num_top_classes=5)
vd = gr.components.Video()
iface = gr.Interface(fn=get_predictions, inputs=vd, outputs=label)
iface.launch(debug=True)