wifix199 commited on
Commit
bcd5c1c
·
verified ·
1 Parent(s): 1f38b4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -2,12 +2,13 @@ import torch
2
  from diffusers import StableDiffusionPipeline
3
  import gradio as gr
4
 
5
- model_id = "SG161222/RealVisXL_V4.0"
6
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
7
- pipe.to("cpu") # Use "cuda" if GPU is available
 
8
 
9
  def generate_image(prompt, pipe):
10
- # Generate the image using the pipeline with proper args handling
11
  image = pipe(prompt, guidance_scale=7.5, num_inference_steps=50).images[0]
12
  return image
13
 
@@ -21,7 +22,7 @@ interface = gr.Interface(
21
  fn=chatbot,
22
  inputs="text",
23
  outputs="image",
24
- title="RealVisXL V4.0 Text-to-Image Chatbot",
25
  description="Enter a text prompt and get an AI-generated image."
26
  )
27
 
 
2
  from diffusers import StableDiffusionPipeline
3
  import gradio as gr
4
 
5
+ # Use the CompVis stable-diffusion-v1-4 model
6
+ model_id = "CompVis/stable-diffusion-v1-4"
7
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32) # float32 for CPU
8
+ pipe.to("cpu") # Ensure it runs on CPU
9
 
10
  def generate_image(prompt, pipe):
11
+ # Generate the image using the pipeline
12
  image = pipe(prompt, guidance_scale=7.5, num_inference_steps=50).images[0]
13
  return image
14
 
 
22
  fn=chatbot,
23
  inputs="text",
24
  outputs="image",
25
+ title="Stable Diffusion v1-4 Text-to-Image Chatbot",
26
  description="Enter a text prompt and get an AI-generated image."
27
  )
28