Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from diffusers import StableDiffusionXLPipeline, EulerDiscreteScheduler
|
4 |
from huggingface_hub import hf_hub_download
|
5 |
-
from safetensors.torch import load_file
|
6 |
import spaces
|
7 |
from PIL import Image
|
8 |
|
@@ -37,7 +36,7 @@ def generate_image(prompt, ckpt):
|
|
37 |
|
38 |
if loaded != num_inference_steps:
|
39 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", prediction_type="sample" if num_inference_steps==1 else "epsilon")
|
40 |
-
pipe.unet.load_state_dict(
|
41 |
loaded = num_inference_steps
|
42 |
|
43 |
results = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=0)
|
|
|
2 |
import torch
|
3 |
from diffusers import StableDiffusionXLPipeline, EulerDiscreteScheduler
|
4 |
from huggingface_hub import hf_hub_download
|
|
|
5 |
import spaces
|
6 |
from PIL import Image
|
7 |
|
|
|
36 |
|
37 |
if loaded != num_inference_steps:
|
38 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", prediction_type="sample" if num_inference_steps==1 else "epsilon")
|
39 |
+
pipe.unet.load_state_dict(torch.load(hf_hub_download(repo_name, ckpt_name), map_location="cuda"))
|
40 |
loaded = num_inference_steps
|
41 |
|
42 |
results = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=0)
|