|
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) |
|
|
|
|
|
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) |
|
|