salman508 commited on
Commit
c499178
·
verified ·
1 Parent(s): f4a01cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py CHANGED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import load_learner, Path
3
+ import torch
4
+
5
+ # Function to perform sequence prediction
6
+ def sequence_prediction(video_path):
7
+ # Load the Fastai model inside the function
8
+ modelx = load_learner('r3d_apparel.pkl')
9
+ result = modelx.predict(Path(video_path))
10
+ return result[0]
11
+
12
+ # Gradio interface
13
+ iface = gr.Interface(
14
+ fn=sequence_prediction,
15
+ inputs=gr.Video(label="Upload a video file"),
16
+ outputs="text",
17
+ live=True # Set live to True to get real-time updates
18
+ )
19
+
20
+ # Launch the Gradio app
21
+ iface.launch()
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+