Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,9 +9,18 @@ from PIL import Image
|
|
9 |
import spaces
|
10 |
import torch
|
11 |
from diffusers import StableDiffusion3Pipeline, DPMSolverSinglestepScheduler, AutoencoderKL
|
|
|
12 |
|
13 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
DESCRIPTION = """# Stable Diffusion 3"""
|
16 |
if not torch.cuda.is_available():
|
17 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo may not work on CPU.</p>"
|
@@ -25,7 +34,7 @@ ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD", "0") == "1"
|
|
25 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
26 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
27 |
|
28 |
-
pipe = StableDiffusion3Pipeline.from_pretrained("
|
29 |
|
30 |
|
31 |
def save_image(img):
|
|
|
9 |
import spaces
|
10 |
import torch
|
11 |
from diffusers import StableDiffusion3Pipeline, DPMSolverSinglestepScheduler, AutoencoderKL
|
12 |
+
from huggingface_hub import snapshot_download
|
13 |
|
14 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
15 |
|
16 |
+
snapshot_download(
|
17 |
+
repo_id="stabilityai/stable-diffusion-3-medium",
|
18 |
+
repo_type="model",
|
19 |
+
ignore_patterns=["*.md", "*..gitattributes"],
|
20 |
+
local_dir="stable-diffusion-3-medium",
|
21 |
+
token=huggingface_token, # yeni bir token-id yazın.
|
22 |
+
)
|
23 |
+
|
24 |
DESCRIPTION = """# Stable Diffusion 3"""
|
25 |
if not torch.cuda.is_available():
|
26 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo may not work on CPU.</p>"
|
|
|
34 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
35 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
36 |
|
37 |
+
pipe = StableDiffusion3Pipeline.from_pretrained("stable-diffusion-3-medium", torch_dtype=torch.float16)
|
38 |
|
39 |
|
40 |
def save_image(img):
|