import gradio as gr from slowfast import slow_fast_train from video_object_extraction import video_object_extraction from audio_feature_extraction_final import audio_feature_extraction from CustomFile import CustomFile import numpy as np import pandas as pd import pickle import torch try: import detectron2 except: import os os.system('pip install git+https://github.com/facebookresearch/detectron2.git') def predict(video_path, frames): # gpu = torch.cuda.is_available() # video_1, df1 = slow_fast_train(video_path, gpu) # video_2, df2 = video_object_extraction(video_path,frames) # audio_path = audio_feature_extraction(video_path, gpu) # return ([video_1, video_2,audio_path], df1, df2) audio_features = np.random.rand(2,2) audio_path = 'audio_embeddings' with open(audio_path, 'wb') as f: pickle.dump(audio_features, f) df = pd.DataFrame() return ([video_path, video_path, audio_path], df, df) iface = gr.Interface(predict, inputs= [gr.Video(),gr.Slider(1, 100, value=15)], outputs=[gr.File(), gr.Dataframe(max_rows = 10),gr.Dataframe(max_rows = 10)]) iface.launch(show_error=True, debug=True)