File size: 818 Bytes
b8f92c8 | 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
import os
from utils import classfication
source_video = "videos/main.mp4"
def video_identity(video):
print(type(video))
try:
os.makedirs(os.path.dirname(source_video ), exist_ok=True)
os.replace(video, source_video )
except Exception as e:
print(f"Error: {e}")
predection =classfication()
files = os.listdir(source_video)
# Iterate through each file and delete
for file in files:
file_path = os.path.join(source_video, file)
if os.path.isfile(file_path):
os.remove(file_path)
return predection
demo = gr.Interface(video_identity,
gr.Video(),
outputs="text"
)
if __name__ == "__main__":
demo.launch(share=True)
|