Update handler.py
Browse files- handler.py +11 -2
handler.py
CHANGED
@@ -47,6 +47,11 @@ class GenerationConfig:
|
|
47 |
enable_teacache: bool = True
|
48 |
teacache_threshold: float = 0.15
|
49 |
|
|
|
|
|
|
|
|
|
|
|
50 |
def validate_and_adjust(self) -> 'GenerationConfig':
|
51 |
"""Validate and adjust parameters"""
|
52 |
# Ensure num_frames follows 4k + 1 format
|
@@ -134,7 +139,9 @@ class EndpointHandler:
|
|
134 |
audio_prompt=params.get("audio_prompt", ""),
|
135 |
audio_negative_prompt=params.get("audio_negative_prompt", "voices, voice, talking, speaking, speech"),
|
136 |
enable_teacache=params.get("enable_teacache", True),
|
137 |
-
teacache_threshold=params.get("teacache_threshold", 0.15)
|
|
|
|
|
138 |
).validate_and_adjust()
|
139 |
|
140 |
try:
|
@@ -209,8 +216,10 @@ class EndpointHandler:
|
|
209 |
"fps": result.metadata.fps,
|
210 |
"duration": result.metadata.duration,
|
211 |
"seed": config.seed,
|
212 |
-
"
|
213 |
"teacache_threshold": config.teacache_threshold if config.enable_teacache else 0,
|
|
|
|
|
214 |
}
|
215 |
}
|
216 |
|
|
|
47 |
enable_teacache: bool = True
|
48 |
teacache_threshold: float = 0.15
|
49 |
|
50 |
+
|
51 |
+
# Enhance-A-Video settings
|
52 |
+
enable_enhance_a_video: bool = True
|
53 |
+
enhance_a_video_weight: float = 4.0
|
54 |
+
|
55 |
def validate_and_adjust(self) -> 'GenerationConfig':
|
56 |
"""Validate and adjust parameters"""
|
57 |
# Ensure num_frames follows 4k + 1 format
|
|
|
139 |
audio_prompt=params.get("audio_prompt", ""),
|
140 |
audio_negative_prompt=params.get("audio_negative_prompt", "voices, voice, talking, speaking, speech"),
|
141 |
enable_teacache=params.get("enable_teacache", True),
|
142 |
+
teacache_threshold=params.get("teacache_threshold", 0.15),
|
143 |
+
enable_enhance_a_video=params.get("enable_enhance_a_video", True),
|
144 |
+
enhance_a_video_weight=params.get("enhance_a_video_weight", 4.0)
|
145 |
).validate_and_adjust()
|
146 |
|
147 |
try:
|
|
|
216 |
"fps": result.metadata.fps,
|
217 |
"duration": result.metadata.duration,
|
218 |
"seed": config.seed,
|
219 |
+
"enable_teacache": config.enable_teacache,
|
220 |
"teacache_threshold": config.teacache_threshold if config.enable_teacache else 0,
|
221 |
+
"enable_enhance_a_video": config.enable_enhance_a_video,
|
222 |
+
"enhance_a_video_weight": config.enhance_a_video_weight if config.enable_enhance_a_video else 0,
|
223 |
}
|
224 |
}
|
225 |
|