Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,9 +17,11 @@ client = Groq(api_key=api_key)
|
|
17 |
|
18 |
# Set device: CUDA if available, else CPU
|
19 |
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
|
|
|
20 |
|
21 |
model_id1 = os.getenv("API_KEY")
|
22 |
-
pipe = StableDiffusionPipeline.from_pretrained(model_id1, torch_dtype=
|
23 |
pipe = pipe.to('cpu')
|
24 |
|
25 |
# Updated function for text generation using the new API structure
|
|
|
17 |
|
18 |
# Set device: CUDA if available, else CPU
|
19 |
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
20 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
21 |
+
|
22 |
|
23 |
model_id1 = os.getenv("API_KEY")
|
24 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id1, torch_dtype=torch_dtype, use_safetensors=True)
|
25 |
pipe = pipe.to('cpu')
|
26 |
|
27 |
# Updated function for text generation using the new API structure
|