Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,12 +22,15 @@ step_loaded = None
|
|
22 |
base_loaded = "Realistic"
|
23 |
motion_loaded = None
|
24 |
|
25 |
-
#
|
26 |
-
if
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
|