Spaces:
Sleeping
Sleeping
Fix code error
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ from diffusers import EulerDiscreteScheduler
|
|
| 9 |
from diffusers import StableDiffusionXLPipeline
|
| 10 |
from diffusers import StableDiffusion3Pipeline
|
| 11 |
from diffusers import StableDiffusionPipeline
|
|
|
|
| 12 |
|
| 13 |
#from transformers import pipeline
|
| 14 |
import gradio as gr
|
|
@@ -16,11 +17,12 @@ import gradio as gr
|
|
| 16 |
# Set Hugging Face API (needed for gated models)
|
| 17 |
hf_api_key = os.environ.get('HF_API_KEY')
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
# Use the Euler scheduler here instead
|
| 20 |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
| 21 |
|
| 22 |
-
# Load the Stable Diffusion pipeline
|
| 23 |
-
model_id = "sd-legacy/stable-diffusion-v1-5"
|
| 24 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 25 |
model_id,
|
| 26 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, # Use float16 on GPU, float32 on CPU
|
|
|
|
| 9 |
from diffusers import StableDiffusionXLPipeline
|
| 10 |
from diffusers import StableDiffusion3Pipeline
|
| 11 |
from diffusers import StableDiffusionPipeline
|
| 12 |
+
from diffusers import DiffusionPipeline
|
| 13 |
|
| 14 |
#from transformers import pipeline
|
| 15 |
import gradio as gr
|
|
|
|
| 17 |
# Set Hugging Face API (needed for gated models)
|
| 18 |
hf_api_key = os.environ.get('HF_API_KEY')
|
| 19 |
|
| 20 |
+
# Load the Stable Diffusion pipeline
|
| 21 |
+
model_id = "sd-legacy/stable-diffusion-v1-5"
|
| 22 |
+
|
| 23 |
# Use the Euler scheduler here instead
|
| 24 |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
| 25 |
|
|
|
|
|
|
|
| 26 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 27 |
model_id,
|
| 28 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, # Use float16 on GPU, float32 on CPU
|