Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,11 @@ import gradio as gr
|
|
2 |
from diffusers import StableDiffusionPipeline
|
3 |
import torch
|
4 |
|
5 |
-
|
6 |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4-original", torch_dtype=torch.float32)
|
7 |
-
pipe.to("cpu") #
|
8 |
|
9 |
-
#
|
10 |
def infer(prompt, guidance_scale=7.5, num_inference_steps=50):
|
11 |
# Generate image from the prompt
|
12 |
image = pipe(prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]
|
|
|
2 |
from diffusers import StableDiffusionPipeline
|
3 |
import torch
|
4 |
|
5 |
+
# Make sure to specify the correct model
|
6 |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4-original", torch_dtype=torch.float32)
|
7 |
+
pipe.to("cpu") # Run on CPU (or change to "cuda" if you have a GPU)
|
8 |
|
9 |
+
# Inference function
|
10 |
def infer(prompt, guidance_scale=7.5, num_inference_steps=50):
|
11 |
# Generate image from the prompt
|
12 |
image = pipe(prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]
|