Alibrown commited on
Commit
fca653e
·
verified ·
1 Parent(s): 8f7b856

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -28,7 +28,16 @@ TORCH_DTYPE = os.getenv('TORCH_DTYPE', 'float16') # Standard-Präzision
28
 
29
  # Modell laden
30
  device = "cuda" if torch.cuda.is_available() else "cpu"
31
- torch_dtype = torch.float16 if torch.cuda.is_available() and TORCH_DTYPE == 'float16' else torch.float32
 
 
 
 
 
 
 
 
 
32
 
33
 
34
  try:
 
28
 
29
  # Modell laden
30
  device = "cuda" if torch.cuda.is_available() else "cpu"
31
+ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
32
+
33
+ try:
34
+ pipe = StableDiffusionPipeline.from_pretrained(
35
+ MODEL_REPO,
36
+ torch_dtype=torch_dtype
37
+ ).to(device)
38
+ except Exception as e:
39
+ raise RuntimeError(f"Failed to load the model. Ensure the token has access to the repo. Error: {e}")
40
+
41
 
42
 
43
  try: