Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -28,6 +28,17 @@ USE_TORCH_COMPILE = os.getenv("USE_TORCH_COMPILE") == "1"
|
|
28 |
ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD") == "1"
|
29 |
OUTPUT_DIR = os.getenv("OUTPUT_DIR", "./outputs")
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
MODEL = os.getenv(
|
32 |
"MODEL",
|
33 |
"https://huggingface.co/Tasty-Rice/Magic_on_paper/blob/main/Magic_on_paper-SDXL-v3.safetensors",
|
@@ -37,7 +48,7 @@ torch.backends.cudnn.deterministic = True
|
|
37 |
torch.backends.cudnn.benchmark = False
|
38 |
|
39 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
40 |
-
|
41 |
|
42 |
def load_pipeline(model_name):
|
43 |
vae = AutoencoderKL.from_pretrained(
|
|
|
28 |
ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD") == "1"
|
29 |
OUTPUT_DIR = os.getenv("OUTPUT_DIR", "./outputs")
|
30 |
|
31 |
+
from diffusers.utils import make_image_grid
|
32 |
+
|
33 |
+
ACCESS_TOKEN = os.environ["ACCESS_TOKEN"]
|
34 |
+
login(token=ACCESS_TOKEN)
|
35 |
+
pipeline = DiffusionPipeline.from_pretrained(
|
36 |
+
"Tasty-Rice/Magic_on_paper/blob/main/Magic_on_paper-SDXL-v3.safetensors",
|
37 |
+
trust_remote_code=True,
|
38 |
+
torch_dtype=torch.float16,
|
39 |
+
use_auth_token=ACCESS_TOKEN
|
40 |
+
)
|
41 |
+
|
42 |
MODEL = os.getenv(
|
43 |
"MODEL",
|
44 |
"https://huggingface.co/Tasty-Rice/Magic_on_paper/blob/main/Magic_on_paper-SDXL-v3.safetensors",
|
|
|
48 |
torch.backends.cudnn.benchmark = False
|
49 |
|
50 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
51 |
+
load_pipeline.to(device)
|
52 |
|
53 |
def load_pipeline(model_name):
|
54 |
vae = AutoencoderKL.from_pretrained(
|