Spaces:
Runtime error
Runtime error
Commit
·
6b22806
1
Parent(s):
0bbb523
update
Browse files- app.py +8 -1
- requirements.txt +2 -2
app.py
CHANGED
@@ -12,6 +12,13 @@ DESCRIPTION = """# SPRIGHT T2I
|
|
12 |
[SPRIGHT T2I](https://spright-t2i.github.io/) is a framework to improve the spatial consistency of text-to-image models WITHOUT compromising their fidelity aspects.
|
13 |
"""
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
MAX_SEED = np.iinfo(np.int32).max
|
16 |
CACHE_EXAMPLES = os.getenv("CACHE_EXAMPLES", "1") == "1"
|
17 |
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "768"))
|
@@ -24,7 +31,7 @@ pipe = DiffusionPipeline.from_pretrained(
|
|
24 |
torch_dtype=torch.float16,
|
25 |
use_safetensors=True,
|
26 |
token=TOKEN,
|
27 |
-
).to(
|
28 |
|
29 |
|
30 |
def save_image(img):
|
|
|
12 |
[SPRIGHT T2I](https://spright-t2i.github.io/) is a framework to improve the spatial consistency of text-to-image models WITHOUT compromising their fidelity aspects.
|
13 |
"""
|
14 |
|
15 |
+
if torch.cuda.is_available():
|
16 |
+
device = "cuda"
|
17 |
+
elif torch.backends.mps.is_available():
|
18 |
+
device = "mps"
|
19 |
+
else:
|
20 |
+
device = "cpu"
|
21 |
+
|
22 |
MAX_SEED = np.iinfo(np.int32).max
|
23 |
CACHE_EXAMPLES = os.getenv("CACHE_EXAMPLES", "1") == "1"
|
24 |
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "768"))
|
|
|
31 |
torch_dtype=torch.float16,
|
32 |
use_safetensors=True,
|
33 |
token=TOKEN,
|
34 |
+
).to(device)
|
35 |
|
36 |
|
37 |
def save_image(img):
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
diffusers
|
2 |
accelerate
|
3 |
-
torch
|
4 |
-
transformers
|
|
|
1 |
diffusers
|
2 |
accelerate
|
3 |
+
#torch
|
4 |
+
transformers
|