LimaRaed commited on
Commit
0a077b8
·
verified ·
1 Parent(s): c9960cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -22,12 +22,15 @@ step_loaded = None
22
  base_loaded = "Realistic"
23
  motion_loaded = None
24
 
25
- # Ensure model and scheduler are initialized in GPU-enabled function
26
- if not torch.cuda.is_available():
27
- raise NotImplementedError("No GPU detected!")
 
 
 
 
 
28
 
29
- device = "cuda"
30
- dtype = torch.float16
31
  pipe = AnimateDiffPipeline.from_pretrained(bases[base_loaded], torch_dtype=dtype).to(device)
32
  pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", beta_schedule="linear")
33
 
 
22
  base_loaded = "Realistic"
23
  motion_loaded = None
24
 
25
+ # Device selection
26
+ if torch.cuda.is_available():
27
+ device = "cuda"
28
+ dtype = torch.float16
29
+ else:
30
+ print("⚠️ No GPU detected! Falling back to CPU. Inference will be slow.")
31
+ device = "cpu"
32
+ dtype = torch.float32
33
 
 
 
34
  pipe = AnimateDiffPipeline.from_pretrained(bases[base_loaded], torch_dtype=dtype).to(device)
35
  pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", beta_schedule="linear")
36