File size: 572 Bytes
c499178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
from fastai.vision.all import load_learner, Path
import torch

# Function to perform sequence prediction
def sequence_prediction(video_path):
    # Load the Fastai model inside the function
    modelx = load_learner('r3d_apparel.pkl')
    result = modelx.predict(Path(video_path))
    return result[0]

# Gradio interface
iface = gr.Interface(
    fn=sequence_prediction,
    inputs=gr.Video(label="Upload a video file"),
    outputs="text",
    live=True  # Set live to True to get real-time updates
)

# Launch the Gradio app
iface.launch()