Spaces:
Paused
Paused
File size: 2,801 Bytes
6e9429f 07e4189 985724b 07e4189 a0d9b43 07e4189 a0d9b43 6e9429f a0d9b43 9588b3c a0d9b43 6e9429f d76cf4f 6e9429f e29835c a0d9b43 e29835c a0d9b43 6e9429f d76cf4f e29835c d76cf4f e29835c a0d9b43 6e9429f e5298d7 07e4189 e5298d7 985724b e5298d7 |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
import gradio as gr
import subprocess
import os
import spaces
# def install_cuda_toolkit():
# # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
# # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run"
# CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
# subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
# subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
# subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
# os.environ["CUDA_HOME"] = "/usr/local/cuda"
# os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
# os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
# os.environ["CUDA_HOME"],
# "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
# )
# # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
# os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
# install_cuda_toolkit()
# from gradio_tabs.animation import animation
# from gradio_tabs.vid_edit import vid_edit
extensions_dir = "./torch_extension/"
os.environ["TORCH_EXTENSIONS_DIR"] = extensions_dir
from networks.generator import Generator
device = torch.device("cuda")
gen = Generator(size=512, motion_dim=40, scale=2).to(device)
gen.load_state_dict(torch.hub.load_state_dict_from_url(f"https://huggingface.co/YaohuiW/LIA-X/resolve/main/lia-x.pt"))
gen.eval()
def load_file(path):
with open(path, 'r', encoding='utf-8') as f:
content = f.read()
return content
custom_css = """
<style>
body {
font-family: Georgia, serif; /* Change to your desired font */
}
h1 {
color: black; /* Change title color */
}
</style>
"""
# def load_tabs():
# from gradio_tabs.animation import animation
# from gradio_tabs.vid_edit import vid_edit
# animation()
# vid_edit()
with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
# ... (input/output setup remains unchanged)
gr.HTML(load_file("assets/title.md"))
with gr.Row():
with gr.Accordion(open=False, label="Instruction"):
gr.Markdown(load_file("assets/instruction.md"))
with gr.Row():
with gr.Tabs():
from gradio_tabs.animation import animation
from gradio_tabs.vid_edit import vid_edit
animation(gen)
vid_edit(gen)
#load_tabs()
#animation()
#vid_edit()
#if __name__ == "__main__":
demo.launch(
server_name='0.0.0.0',
#server_port=7803,
#server_port=10008,
share=True,
allowed_paths=["./data/source","./data/driving"]
)
|