Spaces:
Paused
Paused
ZeroGPU
#356
by
multimodalart
HF Staff
- opened
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import tempfile
|
|
| 5 |
import imageio
|
| 6 |
import torch
|
| 7 |
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
|
|
|
| 8 |
|
| 9 |
pipe = DiffusionPipeline.from_pretrained("cerspense/zeroscope_v2_576w", torch_dtype=torch.float16)
|
| 10 |
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
|
@@ -19,6 +20,7 @@ def export_to_video(frames: np.ndarray, fps: int) -> str:
|
|
| 19 |
writer.close()
|
| 20 |
return out_file.name
|
| 21 |
|
|
|
|
| 22 |
def infer(prompt):
|
| 23 |
negative_prompt = "text, watermark, copyright, blurry, nsfw"
|
| 24 |
video_frames = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=40, height=320, width=576, num_frames=24).frames[0]
|
|
|
|
| 5 |
import imageio
|
| 6 |
import torch
|
| 7 |
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
| 8 |
+
import spaces
|
| 9 |
|
| 10 |
pipe = DiffusionPipeline.from_pretrained("cerspense/zeroscope_v2_576w", torch_dtype=torch.float16)
|
| 11 |
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
|
|
|
| 20 |
writer.close()
|
| 21 |
return out_file.name
|
| 22 |
|
| 23 |
+
@spaces.GPU
|
| 24 |
def infer(prompt):
|
| 25 |
negative_prompt = "text, watermark, copyright, blurry, nsfw"
|
| 26 |
video_frames = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=40, height=320, width=576, num_frames=24).frames[0]
|