Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,18 @@ import torch
|
|
4 |
|
5 |
from transformers import logging
|
6 |
logging.set_verbosity_error() # This suppresses warnings, including cache migration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
# Load your fine-tuned model from Hugging Face
|
|
|
4 |
|
5 |
from transformers import logging
|
6 |
logging.set_verbosity_error() # This suppresses warnings, including cache migration
|
7 |
+
#GPU error
|
8 |
+
from diffusers import StableDiffusionPipeline
|
9 |
+
|
10 |
+
# Load the model
|
11 |
+
model_id = "your-username/stable-diffusion-finetuned"
|
12 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
13 |
+
|
14 |
+
# Check if CUDA is available and move the model to GPU if it is, otherwise use CPU
|
15 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
+
pipe.to(device)
|
17 |
+
|
18 |
+
print(f"Using device: {device}")
|
19 |
|
20 |
|
21 |
# Load your fine-tuned model from Hugging Face
|