Spaces:
Runtime error
Runtime error
Update pages/textimage.py
Browse files- pages/textimage.py +20 -10
pages/textimage.py
CHANGED
|
@@ -9,17 +9,27 @@ from diffusers import PixArtAlphaPipeline
|
|
| 9 |
# Check for CUDA availability
|
| 10 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Load the PixArtAlphaPipeline
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
else:
|
| 22 |
-
st.error("This demo requires GPU support, which is not available on this system.")
|
| 23 |
|
| 24 |
# Constants
|
| 25 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 9 |
# Check for CUDA availability
|
| 10 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 11 |
|
| 12 |
+
# # Load the PixArtAlphaPipeline
|
| 13 |
+
# if torch.cuda.is_available():
|
| 14 |
+
# pipe = PixArtAlphaPipeline.from_pretrained(
|
| 15 |
+
# "PixArt-alpha/PixArt-LCM-XL-2-1024-MS",
|
| 16 |
+
# torch_dtype=torch.float16,
|
| 17 |
+
# use_safetensors=True,
|
| 18 |
+
# )
|
| 19 |
+
# pipe.to(device)
|
| 20 |
+
# st.write("Model loaded successfully!")
|
| 21 |
+
# else:
|
| 22 |
+
# st.error("This demo requires GPU support, which is not available on this system.")
|
| 23 |
+
|
| 24 |
# Load the PixArtAlphaPipeline
|
| 25 |
+
|
| 26 |
+
pipe = PixArtAlphaPipeline.from_pretrained(
|
| 27 |
+
"PixArt-alpha/PixArt-LCM-XL-2-1024-MS",
|
| 28 |
+
torch_dtype=torch.float16,
|
| 29 |
+
use_safetensors=True,
|
| 30 |
+
)
|
| 31 |
+
pipe.to(device)
|
| 32 |
+
st.write("Model loaded successfully!")
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# Constants
|
| 35 |
MAX_SEED = np.iinfo(np.int32).max
|