File size: 1,161 Bytes
6155c0e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fcfec80
 
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
32
33
34
35
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=[CustomFile(), gr.Dataframe(max_rows = 10),gr.Dataframe(max_rows = 10)])
iface.launch(show_error=True)