AhmadMustafa commited on
Commit
d230b19
·
1 Parent(s): eb3a68f
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -17,7 +17,7 @@ pipe = None
17
  device = "cuda" if torch.cuda.is_available() else "cpu"
18
 
19
 
20
- @spaces.GPU
21
  def load_pipeline(
22
  pretrained_model_path="THUDM/CogVideoX-5b",
23
  ef_net_path="weights/EF_Net.pth",
@@ -77,7 +77,7 @@ def load_pipeline(
77
  return "Pipeline loaded successfully!"
78
 
79
 
80
- @spaces.GPU
81
  def generate_inbetweening(
82
  first_image: Image.Image,
83
  last_image: Image.Image,
@@ -286,4 +286,13 @@ with gr.Blocks(title="Sci-Fi: Frame Inbetweening") as demo:
286
  )
287
 
288
  if __name__ == "__main__":
 
 
 
 
 
 
 
 
 
289
  demo.launch()
 
17
  device = "cuda" if torch.cuda.is_available() else "cpu"
18
 
19
 
20
+ @spaces.GPU(duration=1000)
21
  def load_pipeline(
22
  pretrained_model_path="THUDM/CogVideoX-5b",
23
  ef_net_path="weights/EF_Net.pth",
 
77
  return "Pipeline loaded successfully!"
78
 
79
 
80
+ @spaces.GPU(duration=1000)
81
  def generate_inbetweening(
82
  first_image: Image.Image,
83
  last_image: Image.Image,
 
286
  )
287
 
288
  if __name__ == "__main__":
289
+ # Automatically load pipeline on startup
290
+ print("Loading pipeline automatically on startup...")
291
+ try:
292
+ load_pipeline()
293
+ print("Pipeline loaded successfully!")
294
+ except Exception as e:
295
+ print(f"Failed to load pipeline on startup: {e}")
296
+ print("You can manually load it from the Setup tab.")
297
+
298
  demo.launch()