Spaces:
Runtime error
Runtime error
| 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) | |