Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
import os
|
2 |
import spaces
|
3 |
import torch
|
4 |
-
from diffusers import
|
5 |
-
from safetensors.torch import load_file
|
6 |
import gradio as gr
|
7 |
import random
|
8 |
import tqdm
|
@@ -18,17 +17,13 @@ def load_model():
|
|
18 |
filename="AkashicPulse-v1.0-ft-ft.safetensors"
|
19 |
)
|
20 |
|
21 |
-
# Initialize
|
22 |
-
pipe =
|
23 |
-
|
24 |
torch_dtype=torch.float16,
|
25 |
-
variant="fp16",
|
26 |
use_safetensors=True
|
27 |
)
|
28 |
|
29 |
-
# Load the custom model weights
|
30 |
-
state_dict = load_file(model_path)
|
31 |
-
pipe.unet.load_state_dict(state_dict)
|
32 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
33 |
return pipe
|
34 |
|
|
|
1 |
import os
|
2 |
import spaces
|
3 |
import torch
|
4 |
+
from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler
|
|
|
5 |
import gradio as gr
|
6 |
import random
|
7 |
import tqdm
|
|
|
17 |
filename="AkashicPulse-v1.0-ft-ft.safetensors"
|
18 |
)
|
19 |
|
20 |
+
# Initialize standard SD pipeline
|
21 |
+
pipe = StableDiffusionPipeline.from_single_file(
|
22 |
+
model_path,
|
23 |
torch_dtype=torch.float16,
|
|
|
24 |
use_safetensors=True
|
25 |
)
|
26 |
|
|
|
|
|
|
|
27 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
28 |
return pipe
|
29 |
|