Spaces:
Running
on
Zero
Running
on
Zero
Update app_14B.py
Browse files- app_14B.py +16 -0
app_14B.py
CHANGED
|
@@ -10,6 +10,7 @@ from diffusers import WanImageToVideoPipeline
|
|
| 10 |
from diffusers.utils import export_to_video
|
| 11 |
from huggingface_hub import upload_file
|
| 12 |
from PIL import Image
|
|
|
|
| 13 |
|
| 14 |
# ----------------- Setup -----------------
|
| 15 |
logging.basicConfig(level=logging.INFO)
|
|
@@ -87,6 +88,21 @@ def upscale_and_upload_4k(input_video_path: str, input_image, summary_text: str)
|
|
| 87 |
return hf_folder
|
| 88 |
|
| 89 |
# ----------------- Video generation -----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
def generate_video(input_image, prompt, negative_prompt=default_negative_prompt,
|
| 91 |
duration_seconds=2, guidance_scale=3.5, steps=40, seed=0):
|
| 92 |
if input_image is None:
|
|
|
|
| 10 |
from diffusers.utils import export_to_video
|
| 11 |
from huggingface_hub import upload_file
|
| 12 |
from PIL import Image
|
| 13 |
+
import spaces
|
| 14 |
|
| 15 |
# ----------------- Setup -----------------
|
| 16 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 88 |
return hf_folder
|
| 89 |
|
| 90 |
# ----------------- Video generation -----------------
|
| 91 |
+
def get_duration(
|
| 92 |
+
input_image,
|
| 93 |
+
prompt,
|
| 94 |
+
negative_prompt,
|
| 95 |
+
duration_seconds,
|
| 96 |
+
guidance_scale,
|
| 97 |
+
guidance_scale_2,
|
| 98 |
+
steps,
|
| 99 |
+
seed,
|
| 100 |
+
randomize_seed,
|
| 101 |
+
progress,
|
| 102 |
+
):
|
| 103 |
+
return steps * 15
|
| 104 |
+
|
| 105 |
+
@spaces.GPU(duration=70)
|
| 106 |
def generate_video(input_image, prompt, negative_prompt=default_negative_prompt,
|
| 107 |
duration_seconds=2, guidance_scale=3.5, steps=40, seed=0):
|
| 108 |
if input_image is None:
|