Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
Browse files
app.py
CHANGED
@@ -40,19 +40,19 @@ ORIGINAL_MAX_DURATION = round(81/24, 1) # MAX_FRAMES_MODEL/FIXED_FPS
|
|
40 |
# Limited space constants
|
41 |
LIMITED_MAX_RESOLUTION = 640
|
42 |
LIMITED_MAX_DURATION = 2.0
|
43 |
-
LIMITED_MAX_STEPS =
|
44 |
|
45 |
# Set limits based on environment variable
|
46 |
if IS_ORIGINAL_SPACE:
|
47 |
-
SLIDER_MIN_H, SLIDER_MAX_H = ORIGINAL_SLIDER_MIN_H, ORIGINAL_SLIDER_MAX_H
|
48 |
-
SLIDER_MIN_W, SLIDER_MAX_W = ORIGINAL_SLIDER_MIN_W, ORIGINAL_SLIDER_MAX_W
|
49 |
-
MAX_DURATION = ORIGINAL_MAX_DURATION
|
50 |
-
MAX_STEPS = 8
|
51 |
-
else:
|
52 |
SLIDER_MIN_H, SLIDER_MAX_H = 128, LIMITED_MAX_RESOLUTION
|
53 |
SLIDER_MIN_W, SLIDER_MAX_W = 128, LIMITED_MAX_RESOLUTION
|
54 |
MAX_DURATION = LIMITED_MAX_DURATION
|
55 |
MAX_STEPS = LIMITED_MAX_STEPS
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
MAX_SEED = np.iinfo(np.int32).max
|
58 |
|
@@ -125,7 +125,7 @@ def generate_video(prompt, height, width,
|
|
125 |
raise gr.Error("Please enter a text prompt. Try to use long and precise descriptions.")
|
126 |
|
127 |
# Apply limits based on environment variable
|
128 |
-
if
|
129 |
height = min(height, LIMITED_MAX_RESOLUTION)
|
130 |
width = min(width, LIMITED_MAX_RESOLUTION)
|
131 |
duration_seconds = min(duration_seconds, LIMITED_MAX_DURATION)
|
@@ -156,7 +156,7 @@ with gr.Blocks() as demo:
|
|
156 |
gr.Markdown("This Gradio space is a fork of [wan2-1-fast from multimodalart](https://huggingface.co/spaces/multimodalart/wan2-1-fast), and is powered by the Wan CausVid LoRA [from Kijai](https://huggingface.co/Kijai/WanVideo_comfy/blob/main/Wan21_CausVid_bidirect2_T2V_1_3B_lora_rank32.safetensors).")
|
157 |
|
158 |
# Add notice for limited spaces
|
159 |
-
if
|
160 |
gr.Markdown("⚠️ **This free public demo limits the resolution to 640x640, duration to 2s, and inference steps to 3. For full capabilities please duplicate this space.**")
|
161 |
|
162 |
with gr.Row():
|
@@ -211,7 +211,7 @@ with gr.Blocks() as demo:
|
|
211 |
["a field of flowers swaying in the wind, spring morning light", 512, 896],
|
212 |
]
|
213 |
|
214 |
-
if
|
215 |
# Limit example resolutions for limited spaces
|
216 |
example_configs = [
|
217 |
[example[0], min(example[1], LIMITED_MAX_RESOLUTION), min(example[2], LIMITED_MAX_RESOLUTION)]
|
|
|
40 |
# Limited space constants
|
41 |
LIMITED_MAX_RESOLUTION = 640
|
42 |
LIMITED_MAX_DURATION = 2.0
|
43 |
+
LIMITED_MAX_STEPS = 4
|
44 |
|
45 |
# Set limits based on environment variable
|
46 |
if IS_ORIGINAL_SPACE:
|
|
|
|
|
|
|
|
|
|
|
47 |
SLIDER_MIN_H, SLIDER_MAX_H = 128, LIMITED_MAX_RESOLUTION
|
48 |
SLIDER_MIN_W, SLIDER_MAX_W = 128, LIMITED_MAX_RESOLUTION
|
49 |
MAX_DURATION = LIMITED_MAX_DURATION
|
50 |
MAX_STEPS = LIMITED_MAX_STEPS
|
51 |
+
else:
|
52 |
+
SLIDER_MIN_H, SLIDER_MAX_H = ORIGINAL_SLIDER_MIN_H, ORIGINAL_SLIDER_MAX_H
|
53 |
+
SLIDER_MIN_W, SLIDER_MAX_W = ORIGINAL_SLIDER_MIN_W, ORIGINAL_SLIDER_MAX_W
|
54 |
+
MAX_DURATION = ORIGINAL_MAX_DURATION
|
55 |
+
MAX_STEPS = 8
|
56 |
|
57 |
MAX_SEED = np.iinfo(np.int32).max
|
58 |
|
|
|
125 |
raise gr.Error("Please enter a text prompt. Try to use long and precise descriptions.")
|
126 |
|
127 |
# Apply limits based on environment variable
|
128 |
+
if IS_ORIGINAL_SPACE:
|
129 |
height = min(height, LIMITED_MAX_RESOLUTION)
|
130 |
width = min(width, LIMITED_MAX_RESOLUTION)
|
131 |
duration_seconds = min(duration_seconds, LIMITED_MAX_DURATION)
|
|
|
156 |
gr.Markdown("This Gradio space is a fork of [wan2-1-fast from multimodalart](https://huggingface.co/spaces/multimodalart/wan2-1-fast), and is powered by the Wan CausVid LoRA [from Kijai](https://huggingface.co/Kijai/WanVideo_comfy/blob/main/Wan21_CausVid_bidirect2_T2V_1_3B_lora_rank32.safetensors).")
|
157 |
|
158 |
# Add notice for limited spaces
|
159 |
+
if IS_ORIGINAL_SPACE:
|
160 |
gr.Markdown("⚠️ **This free public demo limits the resolution to 640x640, duration to 2s, and inference steps to 3. For full capabilities please duplicate this space.**")
|
161 |
|
162 |
with gr.Row():
|
|
|
211 |
["a field of flowers swaying in the wind, spring morning light", 512, 896],
|
212 |
]
|
213 |
|
214 |
+
if IS_ORIGINAL_SPACE:
|
215 |
# Limit example resolutions for limited spaces
|
216 |
example_configs = [
|
217 |
[example[0], min(example[1], LIMITED_MAX_RESOLUTION), min(example[2], LIMITED_MAX_RESOLUTION)]
|