Spaces:
Sleeping
Sleeping
| 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() | |