Spaces:
Runtime error
Runtime error
Download app.py from doanxem99/Short_Video_Generator: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/doanxem99/Short_Video_Generator/resolve/main/app.py
- Command line
-
hf download hf://spaces/doanxem99/Short_Video_Generator/app.py
-
curl -L -o app.py https://huggingface.co/spaces/doanxem99/Short_Video_Generator/resolve/main/app.py
1.11 kB
| import os | |
| os.system("git clone https://github.com/Begineer17/Short-Video-Generator.git") | |
| os.system("cd Short-Video-Generator") | |
| os.system("pip install -r Short-Video-Generator/requirements.txt") | |
| os.system("pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118") | |
| import gradio as gr | |
| import torch | |
| import subprocess | |
| device = "cuda" if torch.cuda.is_available() else "cpu" | |
| def infer(): | |
| subprocess.call("make_original_video.bat") | |
| file_path = f"result/melody.mp4" | |
| return file_path | |
| if torch.cuda.is_available(): | |
| power_device = "GPU" | |
| else: | |
| power_device = "CPU" | |
| with gr.Blocks() as demo: | |
| with gr.Column(elem_id="col-container"): | |
| gr.Markdown(f""" | |
| # Short Video Generator | |
| -- Click run to generate video -- | |
| Currently running on {power_device}. | |
| """) | |
| with gr.Row(): | |
| run_button = gr.Button("Run", scale=0) | |
| result = gr.Video() | |
| run_button.click( | |
| fn = infer, | |
| inputs = [], | |
| outputs = [result] | |
| ) | |
| demo.queue().launch(share=True) | |