sudo-soldier commited on
Commit
c00a61d
·
verified ·
1 Parent(s): 9993f10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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") # Make sure to use CPU
8
 
9
- # Define the function for inference
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]