Waseem7711 commited on
Commit
72ed8d0
·
verified ·
1 Parent(s): 4420834

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -5,17 +5,17 @@ from PIL import Image
5
 
6
  # Streamlit App Title
7
  st.title("🖼️ Stable Diffusion Image Generator")
8
- st.write("Generate images from text prompts using Stable Diffusion!")
9
 
10
  # Sidebar for prompt input and button
11
  st.sidebar.title("Image Generation Settings")
12
  prompt = st.sidebar.text_input("Enter your prompt", "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k")
13
  generate_button = st.sidebar.button("Generate Image")
14
 
15
- # Cache the Stable Diffusion model to load it only once
16
  @st.cache_resource
17
  def load_model():
18
- model = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
19
  model = model.to("cuda" if torch.cuda.is_available() else "cpu")
20
  return model
21
 
 
5
 
6
  # Streamlit App Title
7
  st.title("🖼️ Stable Diffusion Image Generator")
8
+ st.write("Generate images from text prompts using Stable Diffusion 2.1!")
9
 
10
  # Sidebar for prompt input and button
11
  st.sidebar.title("Image Generation Settings")
12
  prompt = st.sidebar.text_input("Enter your prompt", "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k")
13
  generate_button = st.sidebar.button("Generate Image")
14
 
15
+ # Cache the Stable Diffusion 2.1 model to load it only once
16
  @st.cache_resource
17
  def load_model():
18
+ model = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16)
19
  model = model.to("cuda" if torch.cuda.is_available() else "cpu")
20
  return model
21