Update app.py
Browse files
app.py
CHANGED
|
@@ -2,18 +2,24 @@ import streamlit as st
|
|
| 2 |
from diffusers import StableDiffusionPipeline
|
| 3 |
import torch
|
| 4 |
|
| 5 |
-
# Load the
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
# Streamlit app
|
| 10 |
st.title("Image generation demo")
|
| 11 |
|
| 12 |
-
prompt = st.text_input("Enter a text prompt:", "
|
| 13 |
|
| 14 |
if st.button("Generate Image"):
|
| 15 |
# Generate image from the prompt
|
| 16 |
-
image = pipe(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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")
|