SocialInfinix bot commited on
Commit
ea87144
·
1 Parent(s): 6e7adf5

adaptive: GPU duration from WAN_GPU_DURATION env (free-safe default 150); no code change needed for PRO upgrade

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -64,6 +64,13 @@ _NEGATIVE_PROMPT = (
64
  _pipes = {}
65
  _lock = threading.Lock()
66
 
 
 
 
 
 
 
 
67
  _DEBUG_LOG = "/data/motion-debug.log"
68
 
69
 
@@ -170,7 +177,7 @@ def _save_video(frames, prefix):
170
  return out
171
 
172
 
173
- @spaces.GPU(duration=300)
174
  def image_to_video(image, prompt):
175
  try:
176
  pipe = _i2v_pipe()
@@ -193,7 +200,7 @@ def image_to_video(image, prompt):
193
  raise
194
 
195
 
196
- @spaces.GPU(duration=300)
197
  def text_to_video(prompt):
198
  try:
199
  text = str(prompt or "").strip()
@@ -224,7 +231,7 @@ def text_to_video(prompt):
224
  raise
225
 
226
 
227
- @spaces.GPU(duration=300)
228
  def video_to_video(video, prompt, strength=0.7):
229
  try:
230
  text = str(prompt or "").strip()
@@ -251,7 +258,7 @@ def video_to_video(video, prompt, strength=0.7):
251
  raise
252
 
253
 
254
- @spaces.GPU(duration=300)
255
  def character_animate(reference_video, character_image, mode="animation"):
256
  try:
257
  mode = str(mode or "animation").lower()
 
64
  _pipes = {}
65
  _lock = threading.Lock()
66
 
67
+ # ZeroGPU GPU session budget per request. Kept env-driven so the account can
68
+ # move between Free and PRO tiers WITHOUT code edits — raise it from the Space
69
+ # settings (WAN_GPU_DURATION) when the HF account upgrades.
70
+ # Free tier: per-call cap is small (default 150 is safe; effective ×1.5 = 225s)
71
+ # PRO tier: cap large (recommend 600 -> effective 900s, well under 2400s)
72
+ _GPU_DURATION = int(os.getenv("WAN_GPU_DURATION", "150"))
73
+
74
  _DEBUG_LOG = "/data/motion-debug.log"
75
 
76
 
 
177
  return out
178
 
179
 
180
+ @spaces.GPU(duration=_GPU_DURATION)
181
  def image_to_video(image, prompt):
182
  try:
183
  pipe = _i2v_pipe()
 
200
  raise
201
 
202
 
203
+ @spaces.GPU(duration=_GPU_DURATION)
204
  def text_to_video(prompt):
205
  try:
206
  text = str(prompt or "").strip()
 
231
  raise
232
 
233
 
234
+ @spaces.GPU(duration=_GPU_DURATION)
235
  def video_to_video(video, prompt, strength=0.7):
236
  try:
237
  text = str(prompt or "").strip()
 
258
  raise
259
 
260
 
261
+ @spaces.GPU(duration=_GPU_DURATION)
262
  def character_animate(reference_video, character_image, mode="animation"):
263
  try:
264
  mode = str(mode or "animation").lower()