Spaces:
Running
on
Zero
Running
on
Zero
guardiancc
commited on
Commit
•
1bfb10e
1
Parent(s):
38be4c2
Update app.py
Browse files
app.py
CHANGED
@@ -4,17 +4,18 @@ from diffusers import CogVideoXImageToVideoPipeline
|
|
4 |
from diffusers.utils import export_to_video, load_image
|
5 |
import gradio as gr
|
6 |
|
7 |
-
|
8 |
-
def generate_video(prompt, image):
|
9 |
-
# Carregar a pipeline pré-treinada
|
10 |
-
pipe = CogVideoXImageToVideoPipeline.from_pretrained(
|
11 |
"THUDM/CogVideoX-5b-I2V",
|
12 |
torch_dtype=torch.bfloat16
|
13 |
)
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
18 |
|
19 |
video = pipe(
|
20 |
prompt=prompt,
|
|
|
4 |
from diffusers.utils import export_to_video, load_image
|
5 |
import gradio as gr
|
6 |
|
7 |
+
pipe = CogVideoXImageToVideoPipeline.from_pretrained(
|
|
|
|
|
|
|
8 |
"THUDM/CogVideoX-5b-I2V",
|
9 |
torch_dtype=torch.bfloat16
|
10 |
)
|
11 |
|
12 |
+
pipe.enable_sequential_cpu_offload()
|
13 |
+
pipe.vae.enable_tiling()
|
14 |
+
pipe.vae.enable_slicing()
|
15 |
+
|
16 |
+
@spaces.GPU(duration=250)
|
17 |
+
def generate_video(prompt, image):
|
18 |
+
pipe.to("cuda")
|
19 |
|
20 |
video = pipe(
|
21 |
prompt=prompt,
|