Spaces:
Sleeping
Sleeping
Fix dynamic duration function signature for ZeroGPU compatibility
Browse files- Change get_dynamic_duration to accept *args, **kwargs
- Extract only needed parameters (pipeline, image_size, enable_animation, enable_upscale)
- Fixes TypeError: got multiple values for argument 'pipeline'
- ZeroGPU decorator passes all function arguments to duration function
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -577,12 +577,7 @@ def compile_models_with_aoti():
|
|
| 577 |
return False
|
| 578 |
|
| 579 |
|
| 580 |
-
def get_dynamic_duration(
|
| 581 |
-
pipeline: str,
|
| 582 |
-
image_size: int,
|
| 583 |
-
enable_animation: bool,
|
| 584 |
-
enable_upscale: bool,
|
| 585 |
-
):
|
| 586 |
"""
|
| 587 |
Calculate GPU duration based on benchmarks with 20% safety margin.
|
| 588 |
Max duration capped at 120s (unauthenticated user limit).
|
|
@@ -591,6 +586,12 @@ def get_dynamic_duration(
|
|
| 591 |
Standard: 512+anim=10s, 512-anim=7s, 832+anim=20s, 1024=40s
|
| 592 |
Artistic: 640+anim=23s, 832+anim=45s, 832+anim+upscale=57s, 1024+anim+upscale=124s
|
| 593 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 594 |
if pipeline == "standard":
|
| 595 |
# Standard pipeline benchmarks (with 20% safety margin)
|
| 596 |
if image_size <= 512:
|
|
|
|
| 577 |
return False
|
| 578 |
|
| 579 |
|
| 580 |
+
def get_dynamic_duration(*args, **kwargs):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 581 |
"""
|
| 582 |
Calculate GPU duration based on benchmarks with 20% safety margin.
|
| 583 |
Max duration capped at 120s (unauthenticated user limit).
|
|
|
|
| 586 |
Standard: 512+anim=10s, 512-anim=7s, 832+anim=20s, 1024=40s
|
| 587 |
Artistic: 640+anim=23s, 832+anim=45s, 832+anim+upscale=57s, 1024+anim+upscale=124s
|
| 588 |
"""
|
| 589 |
+
# Extract only the parameters we need from kwargs
|
| 590 |
+
pipeline = kwargs.get('pipeline', 'standard')
|
| 591 |
+
image_size = kwargs.get('image_size', 512)
|
| 592 |
+
enable_animation = kwargs.get('enable_animation', True)
|
| 593 |
+
enable_upscale = kwargs.get('enable_upscale', False)
|
| 594 |
+
|
| 595 |
if pipeline == "standard":
|
| 596 |
# Standard pipeline benchmarks (with 20% safety margin)
|
| 597 |
if image_size <= 512:
|