Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import os
|
2 |
import random
|
3 |
import uuid
|
@@ -137,12 +139,15 @@ ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD", "0") == "1"
|
|
137 |
|
138 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
139 |
|
|
|
|
|
140 |
if torch.cuda.is_available():
|
141 |
repo = "stabilityai/stable-diffusion-3-medium" # You might want to replace with your specific repo if different
|
142 |
pipe = StableDiffusion3Pipeline.from_pretrained(
|
143 |
repo,
|
144 |
torch_dtype=torch.float16,
|
145 |
-
revision="refs/pr/26"
|
|
|
146 |
).to(device)
|
147 |
|
148 |
if ENABLE_CPU_OFFLOAD:
|
@@ -409,4 +414,4 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
409 |
generator = generator
|
410 |
).images[0]
|
411 |
|
412 |
-
return image, seed
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
#patch 0.01
|
3 |
import os
|
4 |
import random
|
5 |
import uuid
|
|
|
139 |
|
140 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
141 |
|
142 |
+
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
143 |
+
|
144 |
if torch.cuda.is_available():
|
145 |
repo = "stabilityai/stable-diffusion-3-medium" # You might want to replace with your specific repo if different
|
146 |
pipe = StableDiffusion3Pipeline.from_pretrained(
|
147 |
repo,
|
148 |
torch_dtype=torch.float16,
|
149 |
+
revision="refs/pr/26",
|
150 |
+
use_auth_token=huggingface_token
|
151 |
).to(device)
|
152 |
|
153 |
if ENABLE_CPU_OFFLOAD:
|
|
|
414 |
generator = generator
|
415 |
).images[0]
|
416 |
|
417 |
+
return image, seed
|