Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,12 +41,10 @@ import gc
|
|
| 41 |
|
| 42 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 43 |
|
| 44 |
-
# hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir="model_real_esran")
|
| 45 |
hf_hub_download(repo_id="wileewang/TransPixar", filename="cogvideox_rgba_lora.safetensors", local_dir="model_cogvideox_rgba_lora")
|
| 46 |
-
# snapshot_download(repo_id="AlexWortega/RIFE", local_dir="model_rife")
|
| 47 |
|
| 48 |
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5B", torch_dtype=torch.bfloat16)
|
| 49 |
-
pipe.enable_sequential_cpu_offload()
|
| 50 |
pipe.vae.enable_slicing()
|
| 51 |
pipe.vae.enable_tiling()
|
| 52 |
pipe.scheduler = CogVideoXDPMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
|
|
@@ -76,14 +74,6 @@ os.makedirs("./gradio_tmp", exist_ok=True)
|
|
| 76 |
# frame_interpolation_model = load_rife_model("model_rife")
|
| 77 |
|
| 78 |
|
| 79 |
-
sys_prompt = """You are part of a team of bots that creates videos. You work with an assistant bot that will draw anything you say in square brackets.
|
| 80 |
-
For example , outputting " a beautiful morning in the woods with the sun peaking through the trees " will trigger your partner bot to output an video of a forest morning , as described. You will be prompted by people looking to create detailed , amazing videos. The way to accomplish this is to take their short prompts and make them extremely detailed and descriptive.
|
| 81 |
-
There are a few rules to follow:
|
| 82 |
-
You will only ever output a single video description per user request.
|
| 83 |
-
When modifications are requested , you should not simply make the description longer . You should refactor the entire description to integrate the suggestions.
|
| 84 |
-
Other times the user will not want modifications , but instead want a new image . In this case , you should ignore your previous conversation with the user.
|
| 85 |
-
Video descriptions must have the same num of words as examples below. Extra words will be ignored.
|
| 86 |
-
"""
|
| 87 |
def save_video(tensor: Union[List[np.ndarray], List[Image.Image]], fps: int = 8, prefix='rgb'):
|
| 88 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 89 |
video_path = f"./output/{prefix}_{timestamp}.mp4"
|
|
|
|
| 41 |
|
| 42 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 43 |
|
|
|
|
| 44 |
hf_hub_download(repo_id="wileewang/TransPixar", filename="cogvideox_rgba_lora.safetensors", local_dir="model_cogvideox_rgba_lora")
|
|
|
|
| 45 |
|
| 46 |
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5B", torch_dtype=torch.bfloat16)
|
| 47 |
+
# pipe.enable_sequential_cpu_offload()
|
| 48 |
pipe.vae.enable_slicing()
|
| 49 |
pipe.vae.enable_tiling()
|
| 50 |
pipe.scheduler = CogVideoXDPMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
|
|
|
|
| 74 |
# frame_interpolation_model = load_rife_model("model_rife")
|
| 75 |
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
def save_video(tensor: Union[List[np.ndarray], List[Image.Image]], fps: int = 8, prefix='rgb'):
|
| 78 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 79 |
video_path = f"./output/{prefix}_{timestamp}.mp4"
|