Arunaabh commited on
Commit
f68b950
·
verified ·
1 Parent(s): 0975f1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -2,18 +2,24 @@ import streamlit as st
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
- # Load the DALL-E model and tokenizer
6
- model_id = "runwayml/stable-diffusion-v1-5"
7
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
 
8
 
9
  # Streamlit app
10
  st.title("Image generation demo")
11
 
12
- prompt = st.text_input("Enter a text prompt:", "a cat in the rain")
13
 
14
  if st.button("Generate Image"):
15
  # Generate image from the prompt
16
- image = pipe(prompt).images[0]
 
 
 
 
 
17
 
18
  # Display the image
19
  st.image(image, caption="Generated Image", channels="RGB")
 
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
+ # Load the model
6
+ repo = "IDKiro/sdxs-512-0.9"
7
+ seed = 42
8
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
9
 
10
  # Streamlit app
11
  st.title("Image generation demo")
12
 
13
+ prompt = st.text_input("Enter a text prompt:", "A gold ring")
14
 
15
  if st.button("Generate Image"):
16
  # Generate image from the prompt
17
+ image = pipe(
18
+ prompt,
19
+ num_inference_steps=1,
20
+ guidance_scale=0,
21
+ generator=torch.manual_seed(seed)
22
+ ).images[0]
23
 
24
  # Display the image
25
  st.image(image, caption="Generated Image", channels="RGB")