Spaces:
Runtime error
Runtime error
new math testing
Browse files
app.py
CHANGED
@@ -34,24 +34,66 @@ pipe.load_lora_weights(causvid_path, adapter_name="causvid_lora")
|
|
34 |
pipe.set_adapters(["causvid_lora"], adapter_weights=[0.95])
|
35 |
pipe.fuse_lora()
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
MOD_VALUE = 32
|
38 |
-
DEFAULT_H_SLIDER_VALUE = 512
|
39 |
-
DEFAULT_W_SLIDER_VALUE = 896
|
40 |
|
41 |
-
#
|
42 |
-
|
|
|
43 |
|
44 |
-
# Original limits
|
45 |
-
|
46 |
-
ORIGINAL_SLIDER_MIN_W, ORIGINAL_SLIDER_MAX_W = 128, 1280
|
47 |
-
ORIGINAL_MAX_DURATION = round(81/24, 1) # MAX_FRAMES_MODEL/FIXED_FPS
|
48 |
|
49 |
-
#
|
50 |
LIMITED_MAX_RESOLUTION = 640
|
51 |
LIMITED_MAX_DURATION = 2.0
|
52 |
LIMITED_MAX_STEPS = 4
|
53 |
|
54 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
if IS_ORIGINAL_SPACE:
|
56 |
SLIDER_MIN_H, SLIDER_MAX_H = 128, LIMITED_MAX_RESOLUTION
|
57 |
SLIDER_MIN_W, SLIDER_MAX_W = 128, LIMITED_MAX_RESOLUTION
|
@@ -61,14 +103,15 @@ else:
|
|
61 |
SLIDER_MIN_H, SLIDER_MAX_H = ORIGINAL_SLIDER_MIN_H, ORIGINAL_SLIDER_MAX_H
|
62 |
SLIDER_MIN_W, SLIDER_MAX_W = ORIGINAL_SLIDER_MIN_W, ORIGINAL_SLIDER_MAX_W
|
63 |
MAX_DURATION = ORIGINAL_MAX_DURATION
|
64 |
-
MAX_STEPS =
|
65 |
|
66 |
MAX_SEED = np.iinfo(np.int32).max
|
67 |
|
68 |
FIXED_FPS = 24
|
69 |
-
FIXED_OUTPUT_FPS = 18
|
70 |
MIN_FRAMES_MODEL = 8
|
71 |
-
MAX_FRAMES_MODEL = 81
|
|
|
72 |
|
73 |
default_prompt_t2v = "cinematic footage, group of pedestrians dancing in the streets of NYC, high quality breakdance, 4K, tiktok video, intricate details, instagram feel, dynamic camera, smooth dance motion, dimly lit, stylish, beautiful faces, smiling, music video"
|
74 |
default_negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards, watermark, text, signature"
|
|
|
34 |
pipe.set_adapters(["causvid_lora"], adapter_weights=[0.95])
|
35 |
pipe.fuse_lora()
|
36 |
|
37 |
+
# MOD_VALUE = 32
|
38 |
+
# DEFAULT_H_SLIDER_VALUE = 512
|
39 |
+
# DEFAULT_W_SLIDER_VALUE = 896
|
40 |
+
|
41 |
+
# # Environment variable check
|
42 |
+
# IS_ORIGINAL_SPACE = os.environ.get("IS_ORIGINAL_SPACE", "True") == "True"
|
43 |
+
|
44 |
+
# # Original limits
|
45 |
+
# ORIGINAL_SLIDER_MIN_H, ORIGINAL_SLIDER_MAX_H = 128, 1280
|
46 |
+
# ORIGINAL_SLIDER_MIN_W, ORIGINAL_SLIDER_MAX_W = 128, 1280
|
47 |
+
# ORIGINAL_MAX_DURATION = round(81/24, 1) # MAX_FRAMES_MODEL/FIXED_FPS
|
48 |
+
|
49 |
+
# # Limited space constants
|
50 |
+
# LIMITED_MAX_RESOLUTION = 640
|
51 |
+
# LIMITED_MAX_DURATION = 2.0
|
52 |
+
# LIMITED_MAX_STEPS = 4
|
53 |
+
|
54 |
+
# # Set limits based on environment variable
|
55 |
+
# if IS_ORIGINAL_SPACE:
|
56 |
+
# SLIDER_MIN_H, SLIDER_MAX_H = 128, LIMITED_MAX_RESOLUTION
|
57 |
+
# SLIDER_MIN_W, SLIDER_MAX_W = 128, LIMITED_MAX_RESOLUTION
|
58 |
+
# MAX_DURATION = LIMITED_MAX_DURATION
|
59 |
+
# MAX_STEPS = LIMITED_MAX_STEPS
|
60 |
+
# else:
|
61 |
+
# SLIDER_MIN_H, SLIDER_MAX_H = ORIGINAL_SLIDER_MIN_H, ORIGINAL_SLIDER_MAX_H
|
62 |
+
# SLIDER_MIN_W, SLIDER_MAX_W = ORIGINAL_SLIDER_MIN_W, ORIGINAL_SLIDER_MAX_W
|
63 |
+
# MAX_DURATION = ORIGINAL_MAX_DURATION
|
64 |
+
# MAX_STEPS = 8
|
65 |
+
|
66 |
+
# MAX_SEED = np.iinfo(np.int32).max
|
67 |
+
|
68 |
+
# FIXED_FPS = 24
|
69 |
+
# FIXED_OUTPUT_FPS = 18 # we downspeed the output video as a temporary "trick"
|
70 |
+
# MIN_FRAMES_MODEL = 8
|
71 |
+
# MAX_FRAMES_MODEL = 81
|
72 |
+
|
73 |
+
|
74 |
+
#New math to make it High Res
|
75 |
+
|
76 |
MOD_VALUE = 32
|
|
|
|
|
77 |
|
78 |
+
# Defaults for higher-res generation
|
79 |
+
DEFAULT_H_SLIDER_VALUE = 768
|
80 |
+
DEFAULT_W_SLIDER_VALUE = 1344 # 16:9 friendly and divisible by MOD_VALUE
|
81 |
|
82 |
+
# Original Space = Hugging Face space with compute limits
|
83 |
+
IS_ORIGINAL_SPACE = os.environ.get("IS_ORIGINAL_SPACE", "True") == "True"
|
|
|
|
|
84 |
|
85 |
+
# Conservative limits for low-end environments
|
86 |
LIMITED_MAX_RESOLUTION = 640
|
87 |
LIMITED_MAX_DURATION = 2.0
|
88 |
LIMITED_MAX_STEPS = 4
|
89 |
|
90 |
+
# Generous limits for local or Pro spaces
|
91 |
+
ORIGINAL_SLIDER_MIN_H, ORIGINAL_SLIDER_MAX_H = 128, 1536
|
92 |
+
ORIGINAL_SLIDER_MIN_W, ORIGINAL_SLIDER_MAX_W = 128, 1536
|
93 |
+
ORIGINAL_MAX_DURATION = round(81 / 24, 1) # 3.4 seconds
|
94 |
+
ORIGINAL_MAX_STEPS = 8
|
95 |
+
|
96 |
+
# Use limited or original (generous) settings
|
97 |
if IS_ORIGINAL_SPACE:
|
98 |
SLIDER_MIN_H, SLIDER_MAX_H = 128, LIMITED_MAX_RESOLUTION
|
99 |
SLIDER_MIN_W, SLIDER_MAX_W = 128, LIMITED_MAX_RESOLUTION
|
|
|
103 |
SLIDER_MIN_H, SLIDER_MAX_H = ORIGINAL_SLIDER_MIN_H, ORIGINAL_SLIDER_MAX_H
|
104 |
SLIDER_MIN_W, SLIDER_MAX_W = ORIGINAL_SLIDER_MIN_W, ORIGINAL_SLIDER_MAX_W
|
105 |
MAX_DURATION = ORIGINAL_MAX_DURATION
|
106 |
+
MAX_STEPS = ORIGINAL_MAX_STEPS
|
107 |
|
108 |
MAX_SEED = np.iinfo(np.int32).max
|
109 |
|
110 |
FIXED_FPS = 24
|
111 |
+
FIXED_OUTPUT_FPS = 18 # reduce final video FPS to save space
|
112 |
MIN_FRAMES_MODEL = 8
|
113 |
+
MAX_FRAMES_MODEL = 81
|
114 |
+
|
115 |
|
116 |
default_prompt_t2v = "cinematic footage, group of pedestrians dancing in the streets of NYC, high quality breakdance, 4K, tiktok video, intricate details, instagram feel, dynamic camera, smooth dance motion, dimly lit, stylish, beautiful faces, smiling, music video"
|
117 |
default_negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards, watermark, text, signature"
|