rohitr01 commited on
Commit
063c24f
·
verified ·
1 Parent(s): c61b7e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -3,12 +3,15 @@ from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
  # Load the pre-trained model from Hugging Face (CompVis is the original model repository)
6
- pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
7
- pipe = pipe.to("cuda")
 
 
8
 
9
  def generate_image(prompt):
10
  # Generate image based on the user's prompt
11
  image = pipe(prompt).images[0]
 
12
  return image
13
 
14
  # Create a Gradio interface
 
3
  import torch
4
 
5
  # Load the pre-trained model from Hugging Face (CompVis is the original model repository)
6
+ pipe = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2", torch_dtype=torch.float16)
7
+
8
+ # Ensure that the model runs on CPU
9
+ pipe = pipe.to("cpu") # Use CPU instead of CUDA (GPU)
10
 
11
  def generate_image(prompt):
12
  # Generate image based on the user's prompt
13
  image = pipe(prompt).images[0]
14
+
15
  return image
16
 
17
  # Create a Gradio interface