Kurumi commited on
Commit ·
ff6166b
1
Parent(s): a7f0e25
fix: use cpu instead
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from flask import (
|
|
| 6 |
send_file,
|
| 7 |
)
|
| 8 |
from io import BytesIO
|
| 9 |
-
from torch import float16
|
| 10 |
from urllib.parse import unquote
|
| 11 |
|
| 12 |
|
|
@@ -26,7 +26,12 @@ def main():
|
|
| 26 |
pretrained_model_or_path="Lykon/DreamShaper",
|
| 27 |
torch_dtype=float16,
|
| 28 |
)
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
image = pipeline(
|
| 32 |
unquote(string=prompt),
|
|
|
|
| 6 |
send_file,
|
| 7 |
)
|
| 8 |
from io import BytesIO
|
| 9 |
+
from torch import cuda, float16
|
| 10 |
from urllib.parse import unquote
|
| 11 |
|
| 12 |
|
|
|
|
| 26 |
pretrained_model_or_path="Lykon/DreamShaper",
|
| 27 |
torch_dtype=float16,
|
| 28 |
)
|
| 29 |
+
|
| 30 |
+
if cuda.is_available():
|
| 31 |
+
pipeline.to("cuda")
|
| 32 |
+
|
| 33 |
+
else:
|
| 34 |
+
pipeline.to("cpu")
|
| 35 |
|
| 36 |
image = pipeline(
|
| 37 |
unquote(string=prompt),
|