Download test.py from Ldrago116/WlSL: direct link, hf CLI and curl.
- Browser
- Download file 818 Bytes
-
https://huggingface.co/spaces/Ldrago116/WlSL/resolve/main/test.py
- Command line
-
hf download hf://spaces/Ldrago116/WlSL/test.py
-
curl -L -o test.py https://huggingface.co/spaces/Ldrago116/WlSL/resolve/main/test.py
818 Bytes
| 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) | |